Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is the default port for SQL Server over a firewall?

1033


What is the difference between mysql and sql server?

943


What is self contained sub query?

973


Which sql server table is used to hold the stored procedure scripts?

1027


Write a query to find 5th highest amount paid from the customer table.

882


What action plan is preferred if sql server is not responding?

1037


What do you mean by tablesample?

1035


What are system databases into sql server (2005/2008) : sql server database administration

967


What are the basic functions for master, msdb, model, tempdb and resource databases?

939


How to Insert multiple rows with a single insert statement?

1002


Can multiple columns be used in sql group by clause in ms sql server?

989


How much memory that we are using in Logshipping Concept?

1731


What is the difference between grant and with grant while giving permissions to the user?

900


What is the purpose of indexing?

1000


What is the difference between seek predicate and predicate?

988