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 the default port for SQL Server over a firewall?
What is the difference between mysql and sql server?
What is self contained sub query?
Which sql server table is used to hold the stored procedure scripts?
Write a query to find 5th highest amount paid from the customer table.
What action plan is preferred if sql server is not responding?
What do you mean by tablesample?
What are system databases into sql server (2005/2008) : sql server database administration
What are the basic functions for master, msdb, model, tempdb and resource databases?
How to Insert multiple rows with a single insert statement?
Can multiple columns be used in sql group by clause in ms sql server?
How much memory that we are using in Logshipping Concept?
What is the difference between grant and with grant while giving permissions to the user?
What is the purpose of indexing?
What is the difference between seek predicate and predicate?