Average of grouped rows in Sql Server

后端 未结 6 1975
名媛妹妹
名媛妹妹 2020-12-11 01:06

I have an Sql Server Table.. it\'s something like this:

Id ...... Column1 ...... Column2  
````````````````````````````````  
1 ........ 1 ............. 34  
2 ..         


        
相关标签:
6条回答
  • 2020-12-11 01:44

    Is this what you want?

    select column1, avg(column2) from table group by column1
    
    0 讨论(0)
  • 2020-12-11 01:45

    simple

    select AVG(Column2) from table group by Column1
    

    doesn't work?

    0 讨论(0)
  • 2020-12-11 01:49

    This following Query will help for Calculate the average value of a ROW:

     select Avg(A.Tamil + A.English + A.Maths + A.Science + A.Social_Science)/5 As 
     Average
     from MarkTable A, MarkTable B, MarkTable C
     where A.RollNo='14UCA002'
    

    This might helpful...

    0 讨论(0)
  • 2020-12-11 01:50
    SELECT column1, AVG(column2) 
      FROM "Insert table name"
    GROUP BY column1 
    
    0 讨论(0)
  • 2020-12-11 01:53

    Execute the following SQL from average :

    select column1,avg(column2) from tablename group by column1;
    
    0 讨论(0)
  • 2020-12-11 01:59
    SELECT Column1, AVG(Column2) FROM test GROUP BY Column1;
    
    0 讨论(0)
提交回复
热议问题