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
Tell me extended events in sql server 2008?
Do you know exporting and importing utility?
Explain system rowset functions?
How to list all login names on the ms sql server?
Explain view in sql server?
What is rolap and its advantage? : sql server analysis services, ssas
Explain the usage of floor function in sql server.
what exactly sql injuction.how to overcome.....
What is subquery in sql?
What is sqlcmd?
What is an index in sql?
Can foreign key be deleted?
Can we check locks in database? If so, how can we do this lock check?
What are different backups available in sql server?
Difference between DELETE and TRUNCATE?