MySQL MySQL选择多个值
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3749933/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 17:11:59 来源:igfitidea点击:
MySQL Select Multiple VALUES
提问by Henson
Totally out of ideas here, could be needing a simple solution.
这里完全没有想法,可能需要一个简单的解决方案。
Basically my desired query is :
基本上我想要的查询是:
SELECT * FROM table WHERE id = 3,4
I want to select only the row which has ID 3 and 4, or maybe name "andy" and "paul"
我只想选择 ID 为 3 和 4 的行,或者命名为“andy”和“paul”
Thank you very much for the answer
非常感谢您的回答
回答by Andomar
Try or
:
尝试or
:
WHERE id = 3 or id = 4
Or the equivalent in
:
或等价物in
:
WHERE id in (3,4)
回答by Sachin Shanbhag
Try this -
尝试这个 -
select * from table where id in (3,4) or [name] in ('andy','paul');