Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Top 20
Message
General information
Forum:
ASP.NET
Category:
Databases
Title:
Re: Top 20
Miscellaneous
Thread ID:
01517858
Message ID:
01517862
Views:
60
>I have a table like:
>Area, Customer,Value
>
>Is there one Sql command which will select the Top 20 Cusotmers, By Value in each Area ?
>Tia
>Gerard

SQL 2005+
;with cte as (select *, row_Number() over (partition by Area order by [Value] DESC) as [Row] FROM CustomersInfo)

select * from cte where Row <=20
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform