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 system database in sql server 2008?
Please explain go command in sql server?
how do you implement one-to-one, one-to-many and many-to-many relationships while designing tables? : Sql server database administration
What is query optimization process?
List the ways in which dynamic sql can be executed?
What is a performance monitor?
How you would rewrite the sql query to return the customerid sorted numerically?
Mention the differences between having and where clause.
How to list all stored procedures in the current database using ms sql server?
How does index makes search faster?
Can foreign key be deleted?
What are the types of indexes?
Explain something about security and SQL Azure?
Why do you want to join software field as you have done your BE in Electronics?
What is user-defined scalar function?