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

What are the advantages to use stored procedures?

1178


I have triggers,views,functions,stored Procedures for a table. When I am dropping that table which objects are deleted?

1188


What do you mean by data integrity?

1126


How to count duplicated values in a column in ms sql server?

1162


Explain cursor as data base object?

1094


You are doing log shipping due to some reasons it is failing. How you will proceed from there

2115


Explain where clause?

1033


What is update_statistics command?

1121


What do you understand by user-defined function in the sql server and explain the steps to create and execute a user-defined function in the sql server?

1018


What are extended events in sql server?

1005


Can you explain different types of locks in sql server?

992


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

1871


Are all views updatable ?

1200


Which sql server is best?

1047


How to create a view on an existing table in ms sql server?

1188