[thelist] [mysql] another sql query... [result]

kris burford kris at midtempo.net
Fri Mar 12 10:55:08 CST 2004


 >> two tables, i want to select rows from table one which don't contain 
within a text cell in table two details from a field in table one.
> > SELECT t1.id, t1.name
> > FROM table_one t1, table_two t2
> > WHERE t2.text_field not like '%t1.name%'
> > ORDER by t1.name";
>
>One small change:
>
>SELECT t1.id, t1.name
>FROM table_one t1, table_two t2
>WHERE t2.text_field not like '%' + t1.name + '%'
>ORDER by t1.name;

after much messing around and eventual subscription to the mysql mailing 
list, i've finally got this to work.

the end result (for anyone interested) is:

SELECT t1.id, t1.name
FROM table_one t1, table_two t2
WHERE t2.text_field not like CONCAT ('%', t1.name, '%')
ORDER by t1.name

many thanks to all for the advice.

regards

kris
--
kris burford
midtempo ltd
http://www.midtempo.net



More information about the thelist mailing list