SQL last day in moth select

Posted by Saif Khan on Stack Overflow See other posts from Stack Overflow or by Saif Khan
Published on 2010-03-15T16:35:22Z Indexed on 2010/03/15 16:39 UTC
Read the original article Hit count: 598

Filed under:
|

I have the following table which is basically the summary of daily transactions and is loaded nightly.

+++++++++++++++++++++++
+ DateCreated + Sale  +
+++++++++++++++++++++++
+ 20100101    + 1000  +
+ 20100131    + 2000  +
+ 20100210    + 2000  +
+ 20100331    + 4000  +
+++++++++++++++++++++++

I need to display the sale by month, but only for the last day in each month.

eg

JAN    2000
FEB       0
MAR    4000

I could probably accomplish this with CASE in my select, but is this efficient? This is SQL Server 2000.

© Stack Overflow or respective owner

Related posts about sql

Related posts about sql-server-2000