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 happens when converting big values to numeric data types?
What methods do you follow to protect from sql injection attack?
What are the properties of the transaction?
Are there issues when exporting SSRS reports into Microsoft Excel? When my users are trying to export a SSRS report into Microsoft Excel, one or two columns in the report appear to merge together. Why might this be?
Why you need indexing? Where that is stored and what you mean by schema object? For what purpose we are using view?
Why does sql studio use a single registered database repository? : sql server management studio
What do you mean by an execution plan? How would you view it?
Explain datetimeoffset data type in sal server 2008?
What are the types of sql server?
What is log ldf?
What is the security principal at the database level that represents your session?
How to write a query with a full outer join in ms sql server?
How to enable/disable indexes?
If you're given a raw data table, how would perform etl (extract, transform, load) with sql to obtain the data in a desired format?
What triggers long term care?