取當(dāng)前日期 到 前3個(gè)月的sql記錄 怎么寫
select * from t where 日期字段名字>DATEADD ( mm, -3, getdate())
//t 是你的表名
?
?
現(xiàn)在程序里得到當(dāng)前時(shí)間和3個(gè)月前的時(shí)間
Date nowDate=new Date();
Date oldDate=new Date();
oldDate.setMonth(oldDate.getMonth()-3);
select * from tab where 日期字段>oldDate and 日期字段<newDate
posted on 2006-09-13 20:24 ericli 閱讀(1941) 評(píng)論(0) 編輯 收藏 所屬分類: SQL