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 command dbcc checkdb used for?
What is the difference between seek predicate and predicate?
What is log shipping?
what are isolation levels? : Sql server database administration
What is ssl in sql server?
Explain different forms of normalization?
What is enhanced database mirroring in sql server 2008?
hi, the following are the outputs of sp_spaceused and sp_tempdbspace sp_spaceused ------------ database size unallocated size tempdb 77752.95 MB 28026.99 MB sp_tempdbspace ------------- database size spaceused tempdb 77752.945312 1.007812 the unused space in sp_spaceused is nearly 28 Gb and in sp_tempdbspace is nearly 76 Gb cany any one explain about this output and why its giving different results.
What is oltp (online transaction processing)?
Explain relational data?
What do you understand by recursive stored procedure?
What is a mutating table error and how can you get around it?
What is unpivot?
Do you know how to implement service broker?
Can we store videos inside the sql server table?