你不可以用空的”in“。
如果没有数,你不需要SQL。
mysql> select * from threads; +------+---------+ | tid | subject | +------+---------+ | 1 | A | | 2 | B | | 3 | C | +------+---------+ 3 rows in set (0.00 sec)
mysql> select tid,subject from threads where tid in (1,2); +------+---------+ | tid | subject | +------+---------+ | 1 | A | | 2 | B | +------+---------+ 2 rows in set (0.00 sec)
mysql> select tid,subject from threads where tid in (); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1