Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Oracle Rank Syntax

Posted on 2004-03-24
3
Medium Priority
?
1,235 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 101

Accepted Solution

by:
mlmcc earned 80 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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. …
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…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Loops Section Overview
Suggested Courses
Course of the Month10 days, 21 hours left to enroll

885 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