SQL query

L

lee

if there are groupings in an sql query, how to extract top 10 records
in every group

for example
ostate ocity sales
OR abc 12000
OR def 1500
OR fgh 900
AL ghu 90
AL hig 30


i want to extract only those Ostate records which have top 2 sales.
in the above table the first two records for state OR will be
extracted because of 2 highest sales. AL 2 rows will also be
extracted and so on.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

SQL 1
open and run access query in excel 1
Pls help with SQL query 12
SQL 2
Tranportation query - interesting one 1
Pls help. urgently required 2
complex sorting query 3
query sql needed 1

Top