Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to find second highest salary

Answer Posted / prakash.matte

if we want to make use of nested query instead of the above,
try the following

select max(column_name) from table_name where column_name =
(select
max(column_name)-(highest_salary_number_for_calculation -1)
from blocks where bid);

Example :

For second highest salary:

select max(bid) from blocks where bid = (select max(bid)-1
from blocks);

For third highest salary:

select max(bid) from blocks where bid = (select max(bid)-2
from blocks);

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is whitespace in html?

1073


Explain type casting and type juggling.

1077


How can we check the value of a given variable is alphanumeric?

1049


Difference between mysql_connect and mysql_pconnect?

1015


What is the function of mysql_real_escape_string in php?

980


Tell me will a comparison of an integer 12 and a string "13" work in php?

1121


What is serialization in php?

1020


How to create database connection and query in php?

1083


What is the difference between file_get_contents() and file_put_contents() in php?

1225


What are the different types of PHP arrays?

1120


What is memcache?

1022


How to execute an sql query?

1035


Why json is used in php?

1048


What is use of mysqli_query in php?

993


How do you remove duplicates from an array?

1101