Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need a single sql statement to find top 3 of a column

Status
Not open for further replies.

kunthavi

Programmer
Nov 11, 2000
1
CA
Hi

I shall be thank ful if you could kindly assist me to write a sql statement to find top 3 of a column?

regards
Suren
 
If you are a student asking this question, then I suggest that you work on it yourself for a while, and then post both your complete question and your proposed answer.
This is a classic question in SQL, and there are many answers, all of which teach a lot of how SQL works.

Some questions you should consider:
What do you do if the table has less than 3 rows?
What do you do if two values are tied (include them, so more than 3 rows are returned? Return only 3, so that one or more rows get excluded arbitrarily? Return an error message, saying there is a tie?)
Malcolm
wynden@telus.net
November is "be kind to dogs and programmers" month. Or is that "dogs or programmers"?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top