divya

divya

  • NA
  • 186
  • 111.9k

How to select Top 2 rows of each id in a table??

Aug 8 2013 2:35 AM
Id NewPropertyIdPropertyTypeAreaPrice
12543712Appartments 1500 60 lakhs
22543712 Appartments180020 Lakhs 
32543712Appartments 220025 lakhs
4444763Commertial shops 1300 60 lakhs
5444763Commertial Shops 1500 50 Lakhs
6444763Commertial Shops 180060 lakhs
7444763Commertial Shops 200030 Lakhs
8444763Commertial Shops 240055 Lakhs

Here How can I select Top two rows of each NewPropertyId  in the above table .I need output Like this.

 
1  2543712   Appartments      1500  60lakhs
2  2543712   Appartments      1800  20 lakhs
4  444763    CommertialShops 1300  60 Lakhs
5  444763    CommertialShops 1500  50 Lakhs

Regards
Divya

Answers (2)