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 are the advantages of using stored procedures?
What is a full text index?
How to create an identity column?
What is the sql server agent?
Can I use sql azure as a backup with log shipping or database mirroring?
What are the extra roles available in msdb? : sql server security
How to drop an existing table?
What is autocommit mode in sql server?
What is a DBMS, query, SQL?
What are trace files?
How to get @@error and @@rowcount at the same time?
Explain sql delete command?
Can we use where clause with group by?
What is the difference between char and varchar2 datatype in sql?
What are two difference between sql azure and azure tables?