Thursday, March 19, 2009

Fetching Top n data from SQL Server table

Here is the way::
Select top n columnname from tblname
if you have 2 data same the use With tie
Select top n with tie colname from tblname
order by colname

Note : OrderBy is required for with tie

No comments:

Post a Comment