:C
I have a query
quote: SELECT DISTINCT shops.* FROM shops, shops_products, shops_products_link WHERE ( ( ( shops_products.product LIKE '%photography%') AND (shops_products.sid = shops.sid) ) OR ( (shops_products_link.child_title LIKE '%photography%') AND ( shops_products.product = shops_products_link.parent_title ) AND (shops_products.sid = shops.sid) ) ) ORDER BY shops.shopname LIMIT 0, 18
But what it basically is is;
quote: SELECT stuff FROM tables WHERE (one condition) OR (another condition)
Except...
To include a table in one of the conditions, I have to have it in the FROM statement.
BUT :(
The first conditions looks at one table, and second at another (seeing if it matches in either of them).
So if the first condition is true, but the second isn't - it won't return anything :(
AND I DO NOT UNDERSTAND. Even worse I'm not sure how to even explain what I am doing, but hope someone with good-geek-eyes can look at it and help me :'S
(Had to make them quotes as the code tags make them scroll)
edit: The simple solution would be to just do two queries and combine the results. BUT that is very messy :( |