gpt4 book ai didi

sql - Where子句有整数范围吗?

转载 作者:行者123 更新时间:2023-12-04 03:47:11 26 4
gpt4 key购买 nike

我需要检查where子句在Integers范围内的表达式结果。

这样的事情:

select * from table where (col1 / col2 ) in (1..8). 

(1..8)表示整数范围。

我的意思是它必须是整数,而不是浮点数。这样我就不能使用 between 1 and 8,因为1.2是正确的。

最佳答案

您当然可以这样做:

select * from table where (col1 / col2 ) in (1,2,3,4,5,6,7,8);

或者
select * from table where (col1 / col2 ) between 1 and 8
and mod (col1 , col2 ) = 0;

关于sql - Where子句有整数范围吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1137751/

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