取當前日期 到 前3個月的sql記錄 怎么寫
select * from t where 日期字段名字>DATEADD ( mm, -3, getdate())
//t 是你的表名
?
?
現(xiàn)在程序里得到當前時間和3個月前的時間
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 閱讀(1943) 評論(0) 編輯 收藏 所屬分類: SQL