关于sql语句中日期的查询 |
您所在的位置:网站首页 › 外来入侵物种排名单表 › 关于sql语句中日期的查询 |
第一种方法:查询2018年1月到2018年10月的数据 select * from 表名 where times between “2018-01-01” and “2018-10-31”; 第二种方法:查询2018年1月到2018年10月的数据(使用 “%”) select * from 表名 where times between “2018-01%” and “2018-11%”; 注:between …and 语法中使用“%”模糊查询日期,后面的日期需要+1;如果sql语句为:select * from 表名 where times between “2018-01%” and “2018-10%”,则sql语句查询的时间为2018-1月到2018年9月的数据信息 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |