Groups | Blog | Home
all groups > sql server (microsoft) > june 2007 >

sql server (microsoft) : Year to Month Calculation


Dip
6/14/2007 1:01:17 AM
Hello Expert,
My data table looks like below:

DIV Year MonthCode Month Actual Vendor
AA 2001 3 SEP-00 200
BANTHORP PTY LTD
AA 2001 4 OCT-00 100
DELTA SALES PTY LTD
BB 2001 5 NOV-00 100 D&F
ACCOUNTING LTD
CC 2001 6 DEC-00 100
BANTHORP PTY LTD

How do I calculate Year to Month for 2001 financial year (JUN-00 to
JUL-01)?
My Excel Pivot table report will have Vendor on Row & Division on
Column so that I can
analyse vendor by division for actual expenditure.

Please help, I got stuck.
Many thanks.
DP
Ed Murphy
6/14/2007 6:21:22 PM
[quoted text, click to view]

This last sentence is highly unclear. Educated guess as to
what you meant:

select Vendor, sum(Actual)
from the_table
where (Year = 2000 and Month >= 6) or (Year = 2001 and Month < 6)
AddThis Social Bookmark Button