Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Always display records from previous 3 months

Status
Not open for further replies.

NEL3644

Technical User
Sep 4, 2000
26
US
What's the query statement that will always display records from previous 3 months. Will anyone please help me?
 
Sort months in descending order and set MAXROWS to 3 months in your query . . . that's if you have months as a field in your database.

hope this helps,
-NeoTurtle
 
First of all your database table should have a date field which captures the date of transaction.

If your database is SQL Server use the query below

select * from tablename
where datefield > dateadd(mm,-3,getdate())

if oracle then use

select * from tablename
where datefield > sysdate-30
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top