sql 查询 3个月内
答案:5 悬赏:20 手机版
解决时间 2021-03-10 18:17
- 提问者网友:我是女神我骄傲
- 2021-03-10 03:32
select * from OrderList where UserName='"&Session("UserName")&"' and datediff(Month,BuyTime,getdate())
最佳答案
- 五星知识达人网友:鸽屿
- 2021-03-10 04:49
DATEDIFF 函数 [日期和时间]格式:DATEDIFF ( date-part, date-expression-1, date-expression-2 );功能:
返回两个日期之间的间隔,即date-expression-2 减 date-expression-1的以date-part为单位的值。例子:SELECt datediff( month, '1999/07/19', '1999/08/23' );//返回 1
SELECT datediff( day, '1999/07/19 00:00', '1999/07/23 23:59' );//返回 4----------------------------------------------------------------------------------------------------修改:select * from OrderList where UserName='"&Session("UserName")&"' and datediff(Month,BuyTime,getdate(),Now)
返回两个日期之间的间隔,即date-expression-2 减 date-expression-1的以date-part为单位的值。例子:SELECt datediff( month, '1999/07/19', '1999/08/23' );//返回 1
SELECT datediff( day, '1999/07/19 00:00', '1999/07/23 23:59' );//返回 4----------------------------------------------------------------------------------------------------修改:select * from OrderList where UserName='"&Session("UserName")&"' and datediff(Month,BuyTime,getdate(),Now)
全部回答
- 1楼网友:撞了怀
- 2021-03-10 09:19
select * from OrderList where UserName='"&Session("UserName")&"' and BuyTime betweengetdate() and dateadd(mm,-3,getdate())
- 2楼网友:底特律间谍
- 2021-03-10 08:44
select * from OrderList where UserName='"&Session("UserName")&"' and datediff(Month,BuyTime,getdate()) =0
- 3楼网友:空山清雨
- 2021-03-10 07:33
--------sqlserver 1.datecolumn between dateadd(mm,-3,getdate()) and getdate() 2.datecolumn between dateadd(mm,-3,指定日期) and 指定日期 --------oracle 1.datecolumn between add_months(sysdate,-3) and sysdate 2.datecolumn between add_months(指定日期, -3) and 指定日期
- 4楼网友:夜风逐马
- 2021-03-10 06:16
select * from OrderList where UserName='"&Session("UserName")&"' and datediff(Month,BuyTime,getdate())
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯