Ramdas
Ramdas

Reputation: 111

display average of two rows

studentname I II
Vivek Johari 30 20
Chandra Singh 30 20
Avinash Dubey 30 25
Pankaj Kumar 33 29

I have a table named student with details as above. I want to find the average of column I and II and display it on a new column using pivot. Please help me to solve this using pivot.. May I use any sub query to solve this using pivot...

Upvotes: 1

Views: 97

Answers (1)

Diego
Diego

Reputation: 36146

your questions is not specific enough. Do you want the total average of both columns? just do

select avg (I), avg(II)
from your_table

if you want just one value, you can do:

select (avg (I) + avg(II))/2
from your_table

Upvotes: 1

Related Questions