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
what is spatial nonclustered index
What are logical/boolean operations in ms sql server?
How will you find out if there are expensive SQL statements running or not?
What do you mean by a dependent functionality in a build?
A trigger can reference objects outside the current database? State true or false.
Explain what is the main purpose of having conversation group?
How to drop an existing table with "drop table" statements in ms sql server?
What is ssrs?
what is memory-optimized nonclustered indexes
Types of Authentications in Sql Server? How user gets authenticated through windows authentication?
Ways to improve the performance of a SQL Azure Database?
What is 3nf normalization?
Explain full-text query in sql server?
Write a program to fetch first 10 records from a file?
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