Home > DeveloperSection > Forums > get average value form table
ezra heywood
ezra heywood

Total Post:145

Posted on    March-11-2013 4:44 AM

 MSSQL Server MSSQL Server 

 1 Reply(s)
 1216  View(s)
Rate this:

Hi Everyone!

I have a table (tblEmployee) as per bellow

ID Name  Salary
-- -----  ------
1 Mark   15000
2 Samuel  20000
3 Ethon  26000
4 Gotibandhu 15000

I want to select table data based on average value of column

e.g. average of table is

2 Samuel  20000

Thank in advance!


Total Post:604

Posted on    March-11-2013 8:43 AM

Hi Ezra!

You can get table data using nested query or sub query, as following

select * from [tblEmployee] where [salary] = (select avg(salary) from [tblEmployee])

Don't want to miss updates? Please click the below button!

Follow MindStick