Jump to content

HELP :( confused in searching method in mysql


superbogel

Recommended Posts

this doesnt work at all  ???

SELECT a.`hook`,a.`name`,a.`price_market`,a.`price_store`,a.`pic_small1` 
FROM `cellphone` AS a 
LEFT JOIN `cellphone_spec` AS b ON a.`hook` = b.`hook` 
WHERE 1 AND 
a.`name` LIKE '%nokia%' AND a.`network` = 'gsm' AND 
(b.`spec_detail_id` = 69 AND b.`detail` LIKE '%radio%' ) AND 
(b.`spec_detail_id` = 57 AND b.`detail` != 'No') AND 
(b.`spec_detail_id` = 18 AND b.`detail` != 'No') AND 
(b.`spec_detail_id` = 12 AND b.`detail` != 'No') AND 
(b.`spec_detail_id` = 19 AND b.`detail` != 'No') AND 
(b.`spec_detail_id` = 20 AND b.`detail` != 'No') 
GROUP BY a.`hook`

 

but if it only consist this it will work :

SELECT a.`hook`,a.`name`,a.`price_market`,a.`price_store`,a.`pic_small1` 
FROM `cellphone` AS a 
LEFT JOIN `cellphone_spec` AS b ON a.`hook` = b.`hook` 
WHERE 1 AND 
a.`name` LIKE '%nokia%' AND a.`network` = 'gsm' AND 
(b.`spec_detail_id` = 69 AND b.`detail` LIKE '%radio%' ) 
GROUP BY a.`hook`

 

i am really newbie in database, pls help somebody

many2 thx in advance

Let's talk about logic for a second.

 

If k = 5, can k also equal 7? Can one thing equal to different things simultaneously? Look at your SQL, if b.spec_detail_id = 69, will it also equal 57 or 57 or 18? That's what you're implying when you join them all with ANDs.

 

Also, what do you mean by WHERE 1?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.