有两种方式:to_char方式和to_date方式假设要查询2011-05-02到2011-05-30之间的数据,实现方式如下:to_date方式:select*fromtablenamewheretime>=to_date('。
- 情感问答
- 答案列表
sql区间查询:sql日期区间查询[朗读]
where1=1andin_avg_valuebetween'30'and'50'orin_max_valuebetween'30'and'50'orin_min_valuebetween'30'and'50'。
时间区间:开始时间和结束时间where时间>=开始时间and时间评论000。
你可以使用substring函数在mysql,sqlserver等数据库系统中都有比如你这个可以这么写select*fromtablewheresubstring(fields,0,4)='s-1-';函数的参数有3个字符串,要截取的开始字节,结束字节【如果省略则表示从开始字节一直到字符串末尾】。
比如查询2014年1月1日-2014年6月30日之间的数据select*from表where日期字段between'20140101'and'20140630'。