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 efficient you are in oracle and SQL server?

606


What are the parts of a function?

499


What does <> symbol mean?

527


you have developed an application which uses many stored procedures and triggers to update various tables users ocassionally get locking problems which tool is best suited to help you diagnose the problem? : Sql server administration

509


Can you explain what are various ways to enhance the ssrs report?

561






Explain how you can deploy an SSRS report?

106


Explain the difference between clustered and non-clustered index?

521


What is federation member?

91


What is the function of inner join?

526


How to scale out a federation by Sql statement?

90


What is merge join?

551


Is it safe to delete log files?

497


Which data type columns are the best candidates for full-text indexing?

575


what are the different ways of moving data/databases between servers and databases in sql server? : Sql server database administration

487


Explain triggers?

539