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 protocol does sql server use?
What do you understand by the analysis services in sql server?
What is 2nf in normalization?
You want to implement the many-to-many relationship while designing tables. How would you do it?
What is an indexing technique?
What is a trigger what are the advantages of trigger?
What does nvl stand for?
Explain try...catch with sql server?
What is the stuff and how does it differ from the replace function?
How to enter unicode character string literals in ms sql server?
Is sql different from sql server?
What are Spatial data types in SQL Server 2008
Can primary key be null?
When cursors are useful?
Do you know concepts and capabilities of sql server?