sql查询给定范围 [英] sql query for give a range

查看:129
本文介绍了sql查询给定范围的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.

我想知道是否可以在sql中给出一个范围.
表示我想获取一个周期到另一个周期的字段中的值.
示例:表格周期和数据中有两个字段.我想根据给定的周期值(例如1到3)获取数据字段中的所有值
我该怎么办?

预先谢谢您

hi everyone.

i want to know whether can we give a range in sql.
means i want to get the values in field where one period to another period.
example:there is two fields in the table period and data. i want to get all the values in data field according to given period value (like 1 to 3)
how can i do this??

thank you in advance

推荐答案

从tbl中选择*,其中周期> = 1和周期< = 3
select * from tbl where period >=1 and period <= 3


select *从atable where atable.alumn在1到3之间.
select * from atable where atable.acolumn between 1 and 3.


从tbl中选择周期在1到3之间的数据
select data from tbl where period between 1 and 3


这篇关于sql查询给定范围的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆