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 ? | 1 Yes | 5 No |
Post New Answer View All Answers
What are the advantages of user-defined functions over stored procedures in sql server?
What happens if ntwdblib.dll is missing on your machine?
How do we know if any query is retrieving a large amount of data or very little data?
Is it important for a database administrator to understand the operating system and file access?
What do you understand by triggers and mention the different types of it?
Explain about system stored procedure?
What area unit the various kinds of info compression introduced in sql server 2008?
How to Insert multiple rows with a single insert statement?
Data table as parameter in sql server?
Where are sql server usernames and passwords stored in the sql server?
What is self join in sql server joins?
What is read uncmmited?
what is normalization? Explain different levels of normalization? : Sql server database administration
What are ddl triggers and types of ddl trigger?
You want to implement the one-to-many relationship while designing tables. How would you do it?