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 difference between dbcc indexdefrag and dbcc reindex?
What is model database in sql server?
Can You Use A Stored Procedure To Provide Data To An Ssrs Report?
How to update values in a table with update statements in ms sql server?
Is BCNF better than 2NF & 3NF? Why?
What do you mean by an execution plan? Why is it used? How would you view it?
How will you go about resolving deadlocks?
What is in place upgrade in sql server?
What is a partition function in sql server?
Explain what is public role in sql server?
How to check status of stored procedure in sql server?
What are the new data types are introduced in sql 2000?
What are the mathematical functions supported by sql server 2005?
How do I clean up sql server transaction log?
What is tcl in sql server?