toooki
asked on
Oralce query question
I have these sub-queries in Oracle (11g):
(select ID, F1 FROM ..) p
(select ID, F2 FROM ..) q
(select ID, F3 FROM ..) r
(select ID, F4 FROM ..) s
From which I need the O/P like:
ID F1 F2 F3 F4
-----------------------
1 6 17 null null
2 null 3 8 null
3 null 4 7 2
4 3 6 11 23
5 8 null null 22
ID is unique in the O/P.The above comes from these input values:
p:
Id F1
-------
1 6
4 3
5 8
q:
Id F2
-------
1 17
2 3
3 4
4 6
r:
Id F3
-------
2 8
3 7
4 11
s:
Id F4
-------
3 2
4 23
5 22
(select ID, F1 FROM ..) p
(select ID, F2 FROM ..) q
(select ID, F3 FROM ..) r
(select ID, F4 FROM ..) s
From which I need the O/P like:
ID F1 F2 F3 F4
-----------------------
1 6 17 null null
2 null 3 8 null
3 null 4 7 2
4 3 6 11 23
5 8 null null 22
ID is unique in the O/P.The above comes from these input values:
p:
Id F1
-------
1 6
4 3
5 8
q:
Id F2
-------
1 17
2 3
3 4
4 6
r:
Id F3
-------
2 8
3 7
4 11
s:
Id F4
-------
3 2
4 23
5 22
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
MIN(F1) AS F1, MIN(F2) AS F2, MIN(F3) AS F3
changed from MIN to MAX.