View previous topic :: View next topic
|
Author |
Message |
tecnokrat Warnings : 1 Active User
Joined: 22 May 2009 Posts: 160 Location: Bangalore
|
|
|
|
Hi,
I have a requirement wherein i have to extract the data for a particular row having DISTINCT COLUMN for the cust_numb
i have been doing the below query:
Code: |
SELECT DISTINCT C1,C2
FROM TABLE A
WHERE A.C1 = '123'
ORDER BY C1,C2
WITH UR; |
The result is as :
Code: |
C1 C2
X 1
X 2
Y 1
Y 2
Z 1
A 1
B 2
|
But now from the above resultant set i need to get only the below rows
Code: |
C1 C2
X 2
Y 2
Z 1
A 1
B 2
|
|
|
Back to top |
|
|
tecnokrat Warnings : 1 Active User
Joined: 22 May 2009 Posts: 160 Location: Bangalore
|
|
|
|
Hi,
I have got the Resultant set thru the Below Query:
Code: |
SELECT DISTINCT C1,C2
FROM TABLE A
WHERE A.C1 = '123'
AND A.C2 = (SELECT MAX(B.C2)
FROM TABLE B
WHERE B.C1 = A.C1)
ORDER BY C1,C2
WITH UR; |
|
|
Back to top |
|
|
|