引用:
Originally posted by 黑狗弟
要找出這個 Date 離今天(以 2003年六月一號 01/06/2003)
超過 365 天.. 或者 730 的 Date...
|
你是指超過 365 天 or 超過 730 天嗎?
有點怪怪的條件…
如果是照你上述所說…
那 sql 大概是長這樣子吧…
select * from table
where (trunc(column) < trunc(sysdate-365)
or trunc(column) < trunc(sysdate-730));
如果是介於超過 -730天 and 未滿 -365天的話…
select * from table
where trunc(column) between trunc(sysdate-729) and trunc(sysdate-366);
ps. 以上全部以日期來計算、不考慮時間…
