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
What is an expression in ms sql server?
What is difference between joins and subqueries?
What command do we use to rename a db, a table and a column?
How do indexes help, types?
How to remove duplicate rows from table?
What are the differences between char and varchar in ms sql server?
What is normalization? What number of normalization shapes are there?
What is Command line parameters in PLSQL.?
What is the maximum size of column in sql server?
What is indexing and its types?
What is the meaning of resultset type_scroll_insensitive?
Which tcl commands are available on the sql server?
What is application role in sql server database security? : sql server security
In what three ways is the return statement used in a stored procedure?
Do you know what is difference between index seek vs. Index scan?