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 / grace
SELECT A.*
FROM dbo.T1 A
WHERE CustomerID IN
(SELECT TOP 10 CustomerID FROM dbo.T1 WHERE City=A.City)
Is This Answer Correct ? | 24 Yes | 6 No |
Post New Answer View All Answers
How do I repair damaged sql server mdf file database? In previous day my mdf file has got damage due to unknown reasons then I used dbcc chekcdb command but it failed, MDF file is important for me, I don’ know that how to get back mdf file data. Please anyone suggest me?
What are the purpose of Normalisation?
Data table as parameter in sql server?
How can you check the level of fragmentation on a table?
How do you use a subquery to find records that exist in one table and do not exist in another?
can we have a nested transaction? : Sql server database administration
What is meant by referential integrity?
What are clustered and non-clustered index?
What are the various editions of sql server 2017 that are available in the market?
Define constraints and give an example of their use?
How to replace the Query Result 'Null Value' with a text ?
Is candidate a key?
What is schemabinding a view?
What is 2nf normalization form?
Can a rule be bound to any column of any data type?