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
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
What are the new data types are introduced in sql 2000?
Can we update data in a view?
Where the sql logs gets stored? : sql server database administration
State the difference between local and global temporary tables?
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?
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
Why do we use non clustered index?
what are candidate key, alternate key and composite key? : Sql server database administration
What encryption security is available in sql azure?
what’s the difference between Covering Indexes and Clustered Indexes ? how to use clustered index small ?
Explain data warehousing in sql server?
What do you mean by 'normalization'?
What are the security related catalog views? : sql server security
What is a transaction and why is it important?