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

you want to be sure that queries in a database always execute at the maximum possible speed. To achieve this goal you have created various indexes on tables which other statement will keep the database in good condition? : Sql server administration

740


What are the new data types are introduced in sql 2000?

671


Can we update data in a view?

775


Where the sql logs gets stored? : sql server database administration

689


State the difference between local and global temporary tables?

793






Your company has 50 branches all over the country all the branches, including the head office have sql server as the database every night all 50 branches upload certain information to the head office which replication topology is best suited for the above scenario?

808


I have a table Events Events containing cardno,time,id,name--each id has a cardno my requirement is every day each employee swipe the card several times i want to calculate first and last time of each card the output should be name 1 2 6 7 in out in out holiday holiday xxx 09:30 06:30 09:40 06:45 where 1,2...... are dates for example january 1,2, etc. 6 and 7 are saturday and sunday how it is posssible

1990


Why do we use non clustered index?

736


what are candidate key, alternate key and composite key? : Sql server database administration

668


What encryption security is available in sql azure?

91


what’s the difference between Covering Indexes and Clustered Indexes ? how to use clustered index small ?

1752


Explain data warehousing in sql server?

774


What do you mean by 'normalization'?

784


What are the security related catalog views? : sql server security

703


What is a transaction and why is it important?

734