I need to use a database using ASP.NET and to take the top 10 items and sort them in ascending order within the top 10. I have used combinations of the following and have not got them to work:
TOP 10 [rows] LIMIT (not supported) ORDER BY [rows] ASC
I need to use a database using ASP.NET and to take the top 10 items and sort them in ascending order within the top 10. I have used combinations of the following and have not got them to work:
TOP 10 [rows] LIMIT (not supported) ORDER BY [rows] ASC
You could do something like this (may not be 100% here, don't have SQL in front of me), but I wouldn't recommend not specifying some kind of order by on the inner select, as if the underlying clustered index changes that would change your results.
select *
from
(select top 10 *
from mytable) as x
order by x.mycolumn asc