1

我有下一个表结构

table_one

+-----+------+
| id  | ref  |
+------------+

表二

+---------+-------+
| id_one  | cont  |  >> Where id_one references id (from first table)
+-----------------+

我正在尝试进行这样的查询

SELECT t1.id FROM table_one t1
INNER JOIN table_two t2 ON t2.id_one=t1.id
WHERE t2.cont IN (int,int,int,int...)
AND t1.ref=1 LIMIT 0,1

...并收到此错误(在 phpMyAdmin 上)

1064 - 您的 SQL 语法有错误;检查 [..] 附近:
'values t1 INNER JOIN values_int t2 ON t2.id_v=t1.id WHERE t2.cont IN (8,13)'

谢谢阅读。

4

1 回答 1

2

values是一个保留字,像这样转义:

...
FROM `values` t1
INNER JOIN ....
于 2013-05-01T13:11:27.547 回答