|
Posted by brendan on 06/21/05 15:09
have an interesting problem ... in a query with several parameters where I
use a LIKE rather than an '=' things go awry ... and I cannot work out why
am extracting from a mysql database ...
I want to extract all links that are
a) where COLUMN 'TYPE'='news' AND COLUMN keyword matches wildcard
%keyword%
OR
b) COLUMN 'TYPE'='image' (no keyword match)
so ... have the following query
"SELECT ... bla bla bla
( (links_DB.type = 'news' AND links_DB.keywords LIKE '%keyword%' ) OR
links_DB.type='image')
bla bla bla"
PROBLEM : this ONLY returns results where column 'TYPE'='news', not ones
where 'TYPE'='image'
HOWEVER :if I change the LIKE to an '=' thus:
((links_DB.type = 'news' AND links_DB.keywords='keyword' ) OR
links_DB.type='image')
I get both links_DB.type ='news' and links_DB.type='image' results!!
What is it about the LIKE clause that stops the second paremeter working???
any help greatly appreciated,
cheers,
brendan.
Navigation:
[Reply to this message]
|