从MySQL获取特定列

时间:2017-06-01 13:09:38

标签: mysql

我正在尝试使用phpmyadmin从表中获取特定列,但它给了我sytanx错误

我的陈述:

SELECT * FROM `node_revisions` WHERE `nid` =4,5,8,20; 

2 个答案:

答案 0 :(得分:1)

您的意思是特定的行(而不是列)。你必须使用:

SELECT * FROM `node_revisions` WHERE `nid` in (4,5,8,20); 

AND concatinated where where:

SELECT * FROM `node_revisions` WHERE `nid` =4 AND `nid` =5 AND `nid` =8 AND `nid` =20; 

答案 1 :(得分:0)

你可能想写:

SELECT * FROM `node_revisions` WHERE `nid` in (4,5,8,20); 

这有帮助吗?