1. We have moved to a new forum! There may be a few things not working properly so please let us know if you find a bug. Remember to use the bbCode [ sql ] tag for SQL statements.

how to find the eigth highest value from a column

Discussion in 'SQL - Questions and Answers' started by arun, Jul 17, 2008.

  1. arun New Member

    hi buddies,

    can anyone help me to find out the eigth highest value from a column. i am using ms sql server 2005 express edition. can u suggest any methods other than sub queries
  2. Unregistered Guest

    SELECT * FROM CompanyMaster WHERE CompanyID =(SELECT TOP 1 CompanyID FROM (SELECT TOP 8 CompanyID FROM CompanyMaster ORDER BY CompanyID DESC)

    POSTED FROM : Jignesh Patel
  3. pooja_1011 New Member

    select distinct value from table a where 8=(select count(distinct value) from table b where b.value >= a.value);
  4. SandeshSegu New Member

    Select * from Employee E1
    where (N-1) = (Select count(distinct(E2.Salary)) From Employee E2
    Where E2.salary > E1.Salary)

    *Replace N by the number required
  5. Unregistered Guest

    Select a.colname from tblname a
    where 8=(select count(distinct b.colname) from tblname b where a.colname<=b.colname )
  6. martiendejong New Member

    Top 8 Bottom 1 I think

Share This Page