Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Select All Rows Except First Two Rows

Author  Topic 

sree432
Starting Member

7 Posts

Posted - 2004-11-18 : 03:14:15
Table Name : Emp
Totals Cols Present : 5
EmpId EmpName
1 ST
2 BL
3 SW
4 BS
5 SR

I wanted to select all rows except first two rows(ie , 1 and 2)
Out Put Should Be Like This
EmpId EmpName
3 SW
4 BS
5 SR

Thanking You.

Sreedhar Reddy

Kristen
Test

22859 Posts

Posted - 2004-11-18 : 03:16:37
SELECT EmpId, EmpName
FROM Emp
WHERE EmpId NOT IN (SELECT TOP 2 EmpId FROM Emp ORDER BY EmpId)
ORDER BY EmpId

Kristen
Go to Top of Page

sree432
Starting Member

7 Posts

Posted - 2004-11-18 : 03:50:54
Thanks you very much kristen.

Actually i am trying with NOT EXISTS and no rows are selected.

Go to Top of Page

lazerath
Constraint Violating Yak Guru

343 Posts

Posted - 2004-11-19 : 10:52:16
If any results are returned from the query within NOT EXISTS, the expression will evalute to false and therefore return no results.
Go to Top of Page
   

- Advertisement -