-
Originally Posted by GesuChandra
for start date of previous month :
DATEADD("m",-1,DATEADD("D",-(DAY(Today())-1),Today()))
for last date of prvious month :
DATEADD("D",-(DAY(Today())),Today())
This doesn't look like Oracle SQL to me.
But this is how I would take a similar approach to find the start and end of a previous month:
select trunc(add_months(datefield, -1), 'MONTH') first_day,
last_day(trunc(add_months(datefield, -1), 'MONTH')) last_day
from mytable;
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|