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 / asim

select id,addressid,city
from
(
SELECT ROW_NUMBER() OVER (partition by city Order by
addressid) ID,AddressID,City
FROM person.Address A
WHERE City IN
(select city from person.address group by City

) )a
where a.ID <11
order by City,ID

Is This Answer Correct ?    6 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many types of subqueries are there in sql server?

993


What is Sqlpaging in SqlServer 2005 ?

1072


What is the use of partition by in sql server?

934


What is an identity?

1023


What does the update command do?

1117


How can I add Reporting Services reports to my application?

129


What is the synonym of join?

963


Do you know the cursor optimization tips?

994


what purpose does the model database serve? : Sql server database administration

985


What is trace flag in sql server?

1029


What is transaction server auto commit?

1068


IF more than one Site is accessing the same Database server and I want to move the DB with Minimum down time? How will you do

1808


Does group by or order by come first?

964


How to create sub reports?

245


What are the rendering extensions of ssrs?

157