Solved

Oracle Rank Syntax

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Grand Totals on Crystal Reports 7 42
"A string is required here" error in Formula 7 50
Crystal Reports Version 7 4 25
Sum of multiple formulas 6 16
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…
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

815 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

8 Experts available now in Live!

Get 1:1 Help Now