|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Thursday, March 07, 2013 10:08 AM
Points: 31,
Visits: 367
|
|
Team,
I have a set of data for perticular day.Plesae help me in writing a sql query to get the average of the data for perticular day.
Table: Day value june 1 4 june 1 5 june 1 2 june 2 1 june 2 5 june 2 3
Ouput needed as below:
day avg value June 1 3.6 june 2 3
As above i need a calculated average result for all the data for a perticualr day.Thanks in advance.
|
|
|
|
|
SSC Rookie
      
Group: General Forum Members
Last Login: Wednesday, February 27, 2013 6:54 AM
Points: 40,
Visits: 168
|
|
|
|
|
|
SSC Eights!
      
Group: General Forum Members
Last Login: 2 days ago @ 4:17 AM
Points: 832,
Visits: 613
|
|
try below code..... declare @t1 table (day varchar(10),value int) insert into @t1 select 'june 1',4 union all select 'june 1',5 union all select 'june 1',2 union all select 'june 2',1 union all select 'june 2',5 union all select 'june 2',3 select [Day], AVG(convert(decimal(10),[Value])) as av from @t1 group by [Day]
|
|
|
|