-5

I cant figure out a where clause to get me the last 30 days of data from a table

Select DATE_ADDED
From INFORMENT.PRODUCT_OFFER_PURCHASE
WHERE ??????-30

I have tried WHERE NFORMENT.PRODUCT_OFFER_PURCHASE.DATE_ADDED > sysdate-30 and that doesn't get me anywhere.

4

2 回答 2

3

一些选项:

date_added >= trunc(sysdate)-30

date_added >= sysdate-30

date_added >= add_month(sysdate,-1)

date_added >= add_month(trunc(sysdate),-1)

http://docs.oracle.com/cd/E11882_01/server.112/e17118/sql_elements001.htm

于 2013-05-23T19:12:50.150 回答
0

我认为它只是类型错误

Select DATE_ADDED
From INFORMENT.PRODUCT_OFFER_PURCHASE
WHERE 
INFORMENT.PRODUCT_OFFER_PURCHASE.DATE_ADDED > sysdate-30
于 2013-05-23T19:31:31.473 回答