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 does the automatic recovery do?
What is single-user mode and what are the steps you should follow to start sql server in single-user mode?
Explain go command in sql server?
whats new about truncate in sql server 2008?
What specific conditions database should meet, before you can bulk copy data into it using bcp?
How to end a stored procedure properly in ms sql server?
If the job running very slow what is the action you do
What is sub query and its properties?
What are the different types of data sources in ssrs?
How do we upgrade from SQL Server 6.5 to 7.0 and 7.0 to 2000?
List the different normalization forms?
What is de-normalization in sql database administration? Give examples?
What will be the maximum number of index per table?
What is a deadlock and what is a live lock?
What does it mean to manipulate data?