Originally posted by Sagar Rohankar:
Pl correct me, If I`m wrong ,I`m weak in DB .
Your subquery returns 60,24,7 as amount... whatever sapno record has any of these amounts it will return but according to given requirement it should return single row for every distinct sapno.
|| is Concatenate operator here. it checks for maxium amount for every sapno and then it returns single row for verey sapno.
You can try by creating dummy table in DB with given data and check whther it works or not
[ August 21, 2008: Message edited by: Madhavi Venna ]
[ August 21, 2008: Message edited by: Madhavi Venna ]