Solved

Oracle Rank Syntax

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
Hello everyone, Hope you find this as helpful as we did. We have on the company I work for an application built in Delphi V with Crystal Reports 8. We all know that Crystal & Delphi can be temperamental sometimes and the worst thing is, nearly…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

867 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

21 Experts available now in Live!

Get 1:1 Help Now