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 normalization and denormalization in sql server?
What is replication with database mirroring? : sql server database administration
How to use union to merge outputs from two queries together in ms sql server?
You have to store user responses of ‘yes’ and ‘no’ what kind of data type is best suited for this task?
Can we linked SharePoint to a SQL database?
What is the cartesian product of the table?
What guidelines should be followed to help minimize deadlocks?
What is coalesce and check constraint in sql server?
How to backup encryption key ?
what are the new features in SSRS?
What is parameterized reports in ssrs ?
explain databases and sql server databases architecture? : Sql server database administration
How to find out the list schema name and table name for the database?
In what three ways is the return statement used in a stored procedure?
Explain important index characteristics?