sql 查询日期 sql查询日期是星期几
您好,今天小然来为大家解答以上的问题。sql 查询日期相信很多小伙伴还不知道,现在让我们一起来看看吧!
1、每年的某一日 dy、ysql数据库中如筛选以日期为条件的记录,可以用有二种方法具体实现,如下:3、datediff()函数种:直接用语句date1与date2是字符串SQL.Tet:='select from table where 字段 between '+Quotedstr(date1)+' and '+Quotedstr(date2);date1与date2是日期SQL.Tet:='select from table where 字段 between '+Quotedstr(DateTimeToStr(date1))+' and '+Quotedstr(DateTimeToStr(date2));SQL.Tet:='select from table where 字段 between :d1 and :d2';Parameters.ParamByName('d1').Value:=date1;Parameters.ParamByName('d2').Value:=date2;什么数据库?如果是 Oracle ,可以WHERE TO_CHAR( 日期字段, 'MM-DD') = '07-05'如果是 SQL , 或者 MySQL 可以WHERE MONTH(日期字段) = 7 AND DAY(日期字段) = 5select from tb where datediff(dd,SendTime,‘2011-07-05’)=0。
本文到这结束,希望上面文章对大家有所帮助。
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系 836084111@qq.com 删除。