Solved

Oracle Rank Syntax

Posted on 2004-03-24
3
1,223 Views
Last Modified: 2012-06-21
This is my synatx

select country,brand,location,year,week,pgroup,style,sales_qty,
stock_qty,
rank() over (partition by country,brand,year,week,pgroup,style order by sales_qty desc) rank  from test
            order by sales_qty desc

But im not getting the rank as desired...it is all showing as 1..
some of the rows are as below

country    brand  location    year   week    pgroup     style      sales_qty        stock_qty         rank
AM          X-       100          2004  9          XAB         X-109    8                    2                    1
AM          X-       101          2004  9          XAB         X-109    8                    3                    1
AM          X-       102          2004  9          XAB         X-107    7                    1                    1
AM          X-       103          2004  9          XAB         X-107    7                    1                    1

Wat is wrng in the query that i wrote?
0
Comment
Question by:sindhuanand
3 Comments
 
LVL 100

Accepted Solution

by:
mlmcc earned 20 total points
ID: 10667718
Looks like it is working to me.

These two rows have the same rank - all values are the same
AM          X-       100          2004  9          XAB         X-109    8                    2                    1
AM          X-       101          2004  9          XAB         X-109    8                    3                    1

The same for the next 2 rows.

Why do you think it isn't working?

mlmcc
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question