hello all
in table1 I have
Date Value
2/1/2010 100
2/2/2010 110
2/5/2010 95
3/4/2010 150
3/15/2010 220
etc
how to sum the value according to it's month ?
so I got Pebruary' sum value=315
March sum value =370
tq
hello all
in table1 I have
Date Value
2/1/2010 100
2/2/2010 110
2/5/2010 95
3/4/2010 150
3/15/2010 220
etc
how to sum the value according to it's month ?
so I got Pebruary' sum value=315
March sum value =370
tq
I don't think you can sum a table that isn't int. Can you put the values in 2 different tables date in 1 amount in another?
This worked for me dateof is the table name in database test
select SUM(CONVERT(INT, right(dateof,3))) as total from test
where dateof < '1/7/2009'
I would try with this:
Select
left(cast(Date as nvarchar),1) as Month
sum(Value) as Value
Group By left(cast(Date as nvarchar),1)
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.