top values and ranking

5 pts.
Tags:
SQL
What function do i use to give a field a ranking based on it's current sorted position in a query. I do not want to use a running sum on a report - it needs to be in the underlying query as I am going to have to join several together.

Answer Wiki

Thanks. We'll let you know when a new response is added.

You didn’t provide enough information, but the general syntax of the SQL RANK function is the following:

<pre>RANK ( ) OVER ( [ < partition_by_clause > ] < order_by_clause > )</pre>

Have a look at the following pages for more information and/or examples:

<a href=”http://msdn.microsoft.com/en-us/library/ms176102.aspx”>RANK (Transact-SQL)</a>
<a href=”http://www.oracle-base.com/articles/misc/RankDenseRankFirstLastAnalyticFunctions.php”>Oracle’s RANK, DENSE_RANK, FIRST and LAST Analytic Functions</a>

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • PenguinWaddle
    Please provide me details about application and version.
    0 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following