我将通过此愚蠢的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 " )

最佳答案

尝试:

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元素都需要分别用引号引起来(如果它是文本列,或者如果是数字列则根本不用引号),并且引号必须是单引号。

关于sql - MYSQL语句语法错误,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/1447564/

10-13 00:58