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!

select only the last day of any month

Status
Not open for further replies.

OldSlowDog

Programmer
Mar 11, 2002
36
US
Hello,
I have a table storing daily sales of our four stores. I need to create a sales report showing only sales on the last day of every month for each store going back as far as we can.

I tried MAX(day(SalesDate)) and it is not working.
Select Max(day(SalesDate), StoreLoc, SalesAmt
FROM Sales
Group by StoreLoc, SalesDate
Order by StoreLoc, SalesDate

Please help.
 
Take a look at this thread from a while back... i had a similar issue:

thread222-1440908

"If I were to wake up with my head sewn to the carpet, I wouldn't be more surprised than I am right now.
 
What does that thread have to do with SQL?
Try:
Code:
SELECT DATEADD(dd, -DAY(DATEADD(m,1,getdate())), DATEADD(m,1,@date))
 
Grabbed the wrong posting looks like. sorry about that.

"If I were to wake up with my head sewn to the carpet, I wouldn't be more surprised than I am right now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top