CodingARgh MySQL

 

Press Ctrl+Enter to quickly submit your post
Quick Reply  
 
 
  
 From:  steve   
 To:  Ben (BENLUMLEY)     
31872.4 In reply to 31872.3 
THANKYOU BEN!

I played with union and made it work so I will stick with that :$ I have a script putting together the query, for multiple-keyword-searches it gets a bit messy :O

quote:
(SELECT DISTINCT shops.* FROM shops, shops_products WHERE (shops_products.product LIKE '%35mm%') AND (shops_products.sid = shops.sid) OR (shops_products.product LIKE '%photography%') AND (shops_products.sid = shops.sid)) UNION (SELECT DISTINCT shops.* FROM shops, shops_products, shops_products_link WHERE ( (shops_products_link.child_title LIKE '%35mm%') AND ( shops_products.product = shops_products_link.parent_title ) 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 shopname LIMIT 0, 18

0/0
 Reply   Quote More 

 From:  Peter (BOUGHTONP)  
 To:  steve      
31872.5 In reply to 31872.4 
You have:
code:
WHERE (shops_products.product LIKE '%35mm%') AND (shops_products.sid = shops.sid)
OR (shops_products.product LIKE '%photography%') AND (shops_products.sid = shops.sid)


You want:
code:
WHERE (shops_products.sid = shops.sid)
AND ((shops_products.product LIKE '%35mm%') OR (shops_products.product LIKE '%photography%'))


(unless I'm missing something?)
0/0
 Reply   Quote More 

 From:  Ben (BENLUMLEY)  
 To:  steve      
31872.6 In reply to 31872.4 

use the joins :@

 

use the joins :@

0/0
 Reply   Quote More 

 From:  steve   
 To:  Peter (BOUGHTONP)     
31872.7 In reply to 31872.5 
Aha yes! The query is made within a loop and I hadn't noticed that - it is now fixed thankyou (aww)

Ben: NO :@

0/0
 Reply   Quote More 

Reply to All    
 

1–7

Rate my interest:

Adjust text size : Smaller 10 Larger

Beehive Forum 1.5.2 |  FAQ |  Docs |  Support |  Donate! ©2002 - 2024 Project Beehive Forum

Forum Stats