MSSQL

Aus crazylinux.de
Version vom 3. Juni 2007, 00:20 Uhr von Jonathan (Diskussion | Beiträge) (Die Seite wurde neu angelegt: This query gives you the same ability as a LIMIT clause does in MySQL and Oracle for MS SQL Server without the headaches of stored procedures or temp tables. <source l...)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen

This query gives you the same ability as a LIMIT clause does in MySQL and Oracle for MS SQL Server without the headaches of stored procedures or temp tables.

select * from (
select top 10 emp_id,lname,fname from (
select top 30 emp_id,lname,fname
from employee
order by lname asc
) as newtbl order by lname desc
) as newtbl2 order by lname asc

from: http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=850&lngWId=5