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
Can two tables share a primary key?
What are the events recorded in a transaction log?
Can we use having clause without group by?
What is difference between join and natural join?
if you encounter this kind of an error message, what you need to look into to solve this problem? : Sql server database administration
How to get the definition of a stored procedure back?
Do you know what is raid and what are different types of raid configurations? : SQL Server Architecture
What is the main purpose of having conversation group?
How you trouble shoot when any job fails
Is there any difference between primary key and unique with the not null condition?
What are the essential components of sql server service broker?
How does recursive cte works in sql server?
What is the sql server 2000 version number?
Can you name some of the dml commands in sql?
Can you get second highest salary from the table?