SQL query

  • Thread starter Thread starter lee
  • Start date Start date
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.
 
Back
Top