Solved

Oracle Rank Syntax

Posted on 2004-03-24
3
1,214 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now