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

what is spatial nonclustered index

546


What are logical/boolean operations in ms sql server?

543


How will you find out if there are expensive SQL statements running or not?

582


What do you mean by a dependent functionality in a build?

661


A trigger can reference objects outside the current database? State true or false.

551






Explain what is the main purpose of having conversation group?

525


How to drop an existing table with "drop table" statements in ms sql server?

556


What is ssrs?

99


what is memory-optimized nonclustered indexes

559


Types of Authentications in Sql Server? How user gets authenticated through windows authentication?

567


Ways to improve the performance of a SQL Azure Database?

103


What is 3nf normalization?

568


Explain full-text query in sql server?

538


Write a program to fetch first 10 records from a file?

607


what are different types of backups available in sql server? Given a particular scenario, how would you go about choosing a backup plan? : Sql server database administration

520