|
Elite Member
|
回覆: 回覆: Oracle SQL 高手請進...
引用:
Originally posted by xmx
你是指超過 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. 以上全部以日期來計算、不考慮時間…
|
其實我要的東西是...
一個 Table 裡面有不同的 Item..
不同 item 都有不同期限..
主要是 365 和 730..
對了...
再問一下...
我這樣直接
testlog.testdate - sysdate 會出現類似 123.889988
這樣..
我想因該是因為時間的關西...
要怎麼把後面那小數點弄掉呀??
__________________

你們都是我的心肝寶貝呀..
|