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.
Author |
Topic |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2007-02-15 : 09:26:04
|
Sriram writes "Hi,I want to retrieve only the first n rows from a query which returns a large number of rows.Say,select empno, name from emp where deptno=100returns 1000 rows.I want to improve the query so that it returns only the first 10 rows and not 1000 rows.Thanks in Advance,Sriram." |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-02-15 : 09:53:59
|
SELECT TOP 10 EmpNo, NameFROM EmpWHERE DeptNo = 100ORDER BY ... -- Name? EmpNo? Shoe size?Peter LarssonHelsingborg, Sweden |
|
|
|
|
|