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 / abhijith
select top 10
from tablename
where city IN
(select distinct(city) from tablename)
Is This Answer Correct ? | 2 Yes | 6 No |
Post New Answer View All Answers
What is a view in sql?
What are cursors stored procedures and triggers?
How do you use a subquery to find records that exist in one table and do not exist in another?
What is use of except clause?
Can we add an identity column to decimal datatype?
Why use update_statistics command in sql server?
What is the full meaning of dml?
Explain iaas, paas and saas?
Is truncate a dml command?
What are the different types of collation sensitivity in sql server?
How to use copy and concatenate commands in SQL?
What is database black box testing?
What is sql server programming?
What is the difference between dropping a database and taking a database offline?
How many database files are there in sql server 2000?what are they?