Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi..

I need to find the data for the last one from today. I know how to get in Sql Server. I wan't the same thing for Oracle server. I am using Oracle 10g server.
That query should be able to extract the data for last one month from today.
For the last 30 days data will do..
I have tried Date_Col>=sysdate-30 but it doesn't work.
Posted
Updated 14-Apr-14 0:41am
v2
Comments
Mantu Singh 14-Apr-14 6:13am    
if U can do it in sql server you can do it in Oracle
comred 14-Apr-14 6:39am    
Fyi, DATEADD function is not there in Oracle

 
Share this answer
 
Comments
Maciej Los 14-Apr-14 6:59am    
+5
Mehdi Gholam 14-Apr-14 7:33am    
Thanks Maciej!
comred 14-Apr-14 7:16am    
I need the data for the last 30 days. Whats all modifications should be done inside the query. Would you please guide me?
comred 14-Apr-14 7:23am    
If there is no data for the given last month period then what should be the output?
I have given one example to get last one months detail in oracle....

SQL
select * from T_STDN_DETAILS where CREATED_ON>=sysdate-30 and CREATED_ON<=sysdate
 
Share this answer
 
v2
Comments
comred 14-Apr-14 7:15am    
I don't know why this sysdate function is failing. What if there is no data available for last 30 days only. What will will be my output? Ideally nothing should return right. Still this query returning me some rows as a result. Pathetic sysdate.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900