我将要用这个愚蠢的mysql语句丢失它。有人可以告诉我这句话有什么问题吗?
SELECT * FROM contacts
INNER JOIN ind_categories ON contacts.vendor_id = ind_categories.vendor_id AND ind_categories.category_id = "retail"
AND WHERE zipcode in ( " 93044,93041,93043 " )
答案 0 :(得分:3)
尝试:
SELECT * FROM contacts INNER JOIN ind_categories ON contacts.vendor_id = ind_categories.vendor_id AND ind_categories.category_id = 'retail' WHERE zipcode in
('93044','93041','93043')
你的WHERE之前不应该有一个AND,IN子句中的每个set元素都需要单独引用(如果它是一个文本列,或者如果它是一个数字列则根本不引用),并且你的引号必须是单个
答案 1 :(得分:3)
SELECT * FROM contacts
INNER JOIN ind_categories
ON contacts.vendor_id = ind_categories.vendor_id AND ind_categories.category_id = "retail" -- AND <<< removed !
WHERE zipcode in ('93044' ,'93041' ,'93043' ) -- <<<< changed the in clause
出了什么问题?
答案 2 :(得分:1)
尝试:
SELECT * FROM contacts
INNER JOIN ind_categories
ON contacts.vendor_id = ind_categories.vendor_id
AND ind_categories.category_id = 'retail'
WHERE zipcode IN ('93044','93041','93043')