View previous topic :: View next topic |
Author |
Message |
nag77 Beginner
Joined: 03 Jan 2006 Posts: 11 Topics: 8
|
Posted: Tue Jan 24, 2006 7:38 am Post subject: Maximum balance without duplicates |
|
|
Hi,
I have a table with 5 cols..
Code: |
Name SSN Balance opening Date closing date
Rahul 001 10,000 12/01/06 12/01/06
Priya 002 20,000 12/01/06 12/01/06
Shukla 003 20,000 12/01/06 12/01/06
Karan 004 20,000 12/01/06 12/01/06
Kannan 005 11,000 12/01/06 12/01/06
Kiran 006 12,000 12/01/06 12/01/06
|
How can I get the maximum balance(no duplicates) when we give the where clause as between opening and closing dates?
Every time I am getting the maximum balance with duplicates.. How can I avoid the duplicates in this situation? |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Tue Jan 24, 2006 8:24 am Post subject: |
|
|
nag77,
Try this
Code: |
SELECT *
FROM TABLE
WHERE BALANCE = (SELECT MAX(BALANCE) FROM TABLE)
FETCH FIRST 1 ROW ONLY
;
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
nag77 Beginner
Joined: 03 Jan 2006 Posts: 11 Topics: 8
|
Posted: Tue Jan 24, 2006 8:45 am Post subject: |
|
|
THANKS KOLUSU |
|
Back to top |
|
 |
|
|