Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

top 10 Sales data based on customerid and city in SQL

User_JL3CWJul 9 2021

Hi,
I have data like below
customer_id city timestamp amount
123 hyderbad currentdate 130
123 hyderbad currentdate 200
200 bangalore currentdate 300
300 bangalore currentdate 400
Customer_id can be multiple times
I have written the following code for top 10 sales based on customer_id as below.
select * from (select customer_id, sum(amount) as totals from customers group by customer_id order by totals desc) where rownum <=10;
I am not able to incorporate city wise top 10 customers.
Please help me to achieve this.
Regards,
Chandra

This post has been answered by BluShadow on Jul 9 2021
Jump to Answer
Comments
Post Details
Added on Jul 9 2021
7 comments
2,017 views