943,866 Members | Top Members by Rank

Ad:
  • MS SQL Discussion Thread
  • Marked Solved
  • Views: 956
  • MS SQL RSS
Mar 17th, 2009
0

greatest three

Expand Post »
hi, i have 3 cols in my db
col 1 ( unique identifier )
col2 ( varchar )
col 3 ( integer )

how can i retrive the 3 greatest values from the database on the basis of col 3..
Reputation Points: 10
Solved Threads: 1
Light Poster
bharatshivram is offline Offline
35 posts
since Mar 2007
Mar 17th, 2009
1

Re: greatest three

MS SQL Syntax (Toggle Plain Text)
  1. SELECT top 3 *
  2. FROM tableName
  3. ORDER BY col3 DESC
Reputation Points: 133
Solved Threads: 141
Veteran Poster
dickersonka is offline Offline
1,162 posts
since Aug 2008
Mar 17th, 2009
0

Re: greatest three

thanx for your reply.
Reputation Points: 10
Solved Threads: 1
Light Poster
bharatshivram is offline Offline
35 posts
since Mar 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MS SQL Forum Timeline: How to create query with date range and interval?
Next Thread in MS SQL Forum Timeline: sql server remote access and user auithentication issue





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC