A table contains list of customers and his city with other
details. Each customer has a unique number and the table
consists millions of data. Query is: I want to retrieve 10
customers from each city, no script, only from single query?
Answer Posted / asim
select id,addressid,city
from
(
SELECT ROW_NUMBER() OVER (partition by city Order by
addressid) ID,AddressID,City
FROM person.Address A
WHERE City IN
(select city from person.address group by City
) )a
where a.ID <11
order by City,ID
Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
What is PROJECTION Operation?
How to change the ownership of a schema in ms sql server?
Explain logical operators in sql server?
What is the significance of null value and why should we avoid permitting null values?
What is a fill factor?
If user is owning any SQL Objects, can we drop that user
How can sql injection be stopped? : sql server security
Explain a checkpoint?
Explain temporary table vs table variable by using cursor alternative?
What are statistics?
What is plan freezing?
Benefits of Stored Procedures?
Explain what are various ways to enhance the ssrs report?
What is a trace frag?
How to drop an existing stored procedure in ms sql server?