gpt4 book ai didi

mysql - 如何编写单个查询来显示多个输入的值

转载 作者:行者123 更新时间:2023-11-29 01:45:33 25 4
gpt4 key购买 nike

   select value from students where coll_Id=1
select value from students where coll_Id=2
select value from students where coll_Id=3
select value from students where coll_Id=4
select value from students where coll_Id=5
select value from students where coll_Id=6
select value from students where coll_Id=7
select value from students where coll_Id=8
select value from students where coll_Id=9
select value from students where coll_Id=10

如何为上述语句编写单个查询。

最佳答案

select value from students where coll_Id in (1,2,3,4,5,6,7,8,9,10);

编辑://查看@t-clausen.dk 的问题评论

如果你总是处理你可以使用的范围

select value from students where coll_Id between 1 and 10;

相当于

select value from students where coll_Id >= 1 and coll_id <= 10;

关于mysql - 如何编写单个查询来显示多个输入的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7764457/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com