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 are the security related catalog views? : sql server security
What are the types of resultset?
Explain what is the use of custom fields in report?
what are isolation levels? : Sql server database administration
Which operator do you use to return all of the rows from one query except rows are returned in a second query?
How to convert numeric expression data types by assignment operations?
how to avoid cursors? : Sql server database administration
What is difference between Datepart() and Datename() in SqlServer?
What is the difference between composite index and covering index?
What do you understand by triggers?
What is partition in sql server?
What are the different types of lock modes in sql server 2000?
What is a performance monitor?
What are the purpose of Normalisation?
How to check status of stored procedure in sql server?