[PHP-DB] REGEXP problem From: martin.adler <email protected>
Date: 06/14/02

Hi,

I working with this query
SELECT * FROM entries LEFT JOIN category ON entries.cat_no REGEXP
\"\\\\.\"+category.id+\"(\\\\.|$)\" LEFT JOIN entgroup ON entries.id = entgroup.eid
LEFT JOIN catgroup ON category.id = catgroup.cid LEFT JOIN mzgroup ON
mzgroup.id = entgroup.gid || catgroup.gid WHERE entries.cat_no REGEXP
\"\\\\.24(\\\\.|$)\";

interessting for me ist only this part

ON entries.cat_no REGEXP \"\\\\.\"+category.id+\"(\\\\.|$)\"

i\'ll get this result from mysql

+----+-----+----------+---------------+------------+--------------+---------------------------------------------------------+-------+------+--------+----------+------+------+------+------+------+---------+
| id | uid | cat_no | head | date | author | text
                   | keywd | id | cat_no | cat | gid | eid | gid
| cid | id | name |
+----+-----+----------+---------------+------------+--------------+---------------------------------------------------------+-------+------+--------+----------+------+------+------+------+------+---------+
| 6 | 2 | 0.1.2.24 | Wer nicht ... | 2002-06-13 | Martin Adler | .in der
Gruppe Technik ist soll dies
nicht lesen können | | 1 | 0 | ROOT | NULL | NULL | NULL
| NULL | NULL | NULL |
| 6 | 2 | 0.1.2.24 | Wer nicht ... | 2002-06-13 | Martin Adler | .in der
Gruppe Technik ist soll dies
nicht lesen können | | 2 | 0.1 | Hardware | NULL | NULL | NULL
| NULL | NULL | NULL |
| 6 | 2 | 0.1.2.24 | Wer nicht ... | 2002-06-13 | Martin Adler | .in der
Gruppe Technik ist soll dies
nicht lesen können | | 4 | 0.1.2 | HP | NULL | NULL | NULL
| NULL | NULL | NULL |
| 6 | 2 | 0.1.2.24 | Wer nicht ... | 2002-06-13 | Martin Adler | .in der
Gruppe Technik ist soll dies
nicht lesen können | | 24 | 0.1.2 | abba | NULL | NULL | 2
| 24 | 2 | technik |
+----+-----+----------+---------------+------------+--------------+---------------------------------------------------------+-------+------+--------+----------+------+------+------+------+------+---------+

with the REGEXP i hope to get all categories where id is listed in the
cat_no from the entries table. cat_no should show a thread but the 3\'rd
result isn\'t part of the cat_no so REGEXP don\'t work how i expected
How can i fix this?

thans for help

Martin

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php