Forum Replies Created

Viewing 3 posts - 1 through 3 (of 3 total)

  • RE: find 2nd highest value in a table

    Create table tmp_table (name varchar(20),age int)

    Insert into tmp_table Values('Hari',27)

    Insert into tmp_table Values('Sai gopal',27)

    Insert into tmp_table Values('Jeeva',29)

    Insert into tmp_table Values('Shanmuga Raja',25)

    Insert into tmp_table Values('Senthil',26)

    Insert into tmp_table Values('Sandesh',27)

    Insert into tmp_table Values('Segu',25)

    )

    Select *...

  • RE: find 2nd highest value in a table

    You can change and use it for getting nth highest salary from Employee table as follows

    SELECT TOP 1 salary

    FROM (

    SELECT DISTINCT...

  • RE: find 2nd highest value in a table

    select top 1 * from (select top n * from dbo.emp order by sal desc) a order by sal

    😀

Viewing 3 posts - 1 through 3 (of 3 total)