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 / grace
SELECT A.*
FROM dbo.T1 A
WHERE CustomerID IN
(SELECT TOP 10 CustomerID FROM dbo.T1 WHERE City=A.City)
Is This Answer Correct ? | 24 Yes | 6 No |
Post New Answer View All Answers
What is change data capture (cdc) feature?
What is the difference between locking and multi-versioning?
Can we insert data into view sql server?
What are scalar functions in sql?
What is outer join in sql server joins?
How to list all objects in a given schema?
explain different types of backups avaialabe in sql server? Given a particular scenario, how would you go about choosing a backup plan? : Sql server database administration
How do I view a stored procedure in sql server?
What does it mean to normalize a database and why would you do it?
What is partition in sql server?
What are the steps you will take to improve the performance of a poor performing query?
How much does sql server 2016 cost?
Can we take the full database backup in log shipping?
What is merge replication?
What is the use of custom fields in report?