Top and Bottom are really just a matter of the order by. Here are some examples that may help. Declare tbl Table id int. Select top 3 id From tbl Order By id.
We've got lots of great SQL Server experts to answer whatever question you can come up with. X Not Just a Number. Cross Join. Home Weblogs Forums Search:. If yes, can someone please tell me how? I'd appreciate it.
By using our site, you acknowledge that you have read and understand our Cookie Policy , Privacy Policy , and our Terms of Service. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. I know this might probably sound like a stupid question, but please bear with me. In SQL-server we have.
These are also summarized in a table at the end of this article. You can also select specified number of records from the bottom of a query result. To do this you can use a trick to order the records in descending order as so:. Keep in mind when the results are sorted in descending order, the largest amounts are returned first. Because of this, TOP returns those products with the highest standard cost.