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 / rakesh ameta
create table newq(ids numeric(5),sname nvarchar(10),city nvarchar(10))
select * from newq where newq.ids in(select top 10 ids from newq x where newq.city=x.city)
| Is This Answer Correct ? | 0 Yes | 2 No |
Post New Answer View All Answers
What is the minimum and maximum number of partitions required for a measure group? : sql server analysis services, ssas
How do we know if any query is retrieving a large amount of data or very little data?
What is a deadlock and what is a live lock?
What is a covered index?
What is delete query?
What is report rendering ?
How can you insert values in multiple rows using one Insert statement?
How to Improve the performencs of SQL Server 2005 exclude stored Procedure and Indexes?
What is simple indexing method?
What the difference between UNION and UNIONALL?
What does the update command do?
why would you call update statistics? : Sql server database administration
Explain acid?
Explain what are the different index configurations a table can have?
How to test subquery results with the exists operator?