HiI am trying to create a list of top 3 order values by country/region/sub-region within a table, and I need to extract and combine all top 3 values from another table. So I want to have this:COUNTRY REGION SUB-REGION VALUE======= ====== ========== =====EU SE EE 250kEU SE EE 200kEU SE EE 100k
But I have about 20 combinations of countrys/regions/sub-regions and need to extract all the values and keep them in order of highest value. You can see the example below with bold highest values for each combination:COUNTRY REGION SUB-REGION VALUE======= ====== ========== =====EU SE EE 250kEU SE EE 200kEU SE EE 100kEU NE EE 450kEU NE EE 300kEU NE EE 150kEU NW EE 350kEU NW EE 250kEU Nw EE 150k...............
A query I use for all the regions but just change the values for the combinations is:SELECT TOP 3 *FROM RegionOrder rWHERE r.Country='EU' and r.Region ='SE' and r.Sub_Region = 'EE'ORDER BY Value DESC
So I can easily select all the values but looking for an easier way than creating a view per combination and then combining them into another view? If I use union in a view create statement I need to create about 90 select statements and because I can only use order by at the end of create view the values do not show as I would like them to show - I would like them to show as per in the table.ThanksG