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 / ravi kumar ravuri

select * from Customer where Customer_ID in (select top 10
from Customer Where City_name in ( select City_Name from
Customer Group by City_Name))

Is This Answer Correct ?    0 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do I schedule a sql server profiler trace?

540


how you can configure a running aggregate in SSRS?

114


What is cte (common table expression)?

601


What is a with(nolock)?

581


Explain following error properties?

564






How to define and use table alias names in ms sql server?

565


What are the 7 disadvantages to a manual system?

515


What is the order in which the sql query is executed?

528


Explain filtered indexes benefits?

597


What are sql servers used for?

513


How to provide column names in insert statements in ms sql server?

610


What are window functions in sql server?

517


What is coalesce in sql server?

541


Define magic tables in sql server?

573


Difference between Sql server reporting services and Crystal reports?

124