user8499001
user8499001

Reputation:

Returning Records from last 6 Months with SELECT

Lets say I have a Table of all people born this year and last year, How can I only Select the ones of the past 6 months?

I have tried this but it didn't work:

   Select * From table WHERE DateColumn >= now()-interval 6 month;

i got following error:

ORA-00904: "NOW": invalid identifier
00904. 00000 -  "%s: invalid identifier

The Data Type is Time-stamped.

Upvotes: 6

Views: 32053

Answers (1)

ShreyasG
ShreyasG

Reputation: 806

I think something like this might work:

Select * From table 
WHERE 
DateColumn >= add_months(sysdate, -6);

Upvotes: 21

Related Questions