Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

SubQueries

User_7FAONMay 6 2022

Select * from A;
No Q R
------ ----- -----
1 F1 L1
2 F2 L2
3 F3 L3

Select * from C;

No JDate EDate NoofDays
----- ------- ---------- -----------
1 01-01-22 05-02-22 1
1 01-06-22 12-06-22 3
3 10-07-22 15-07-22 1

Output :

No Name NoofDays
---- -------- ------------
1 F1L1 4
2 F2L2 0
3 F3L3 1

The Query I tried and Failed :

With t as
(
Select a.No, Sum(NoofDays) as NoofDays from A a left outer join C b on a.No = b.No group by a.No
(
Select No, concat(Q,R) as Name
(
Select No, regexp_replace(NAME,'( )','') as Name, NoofDays from t
)
)
)

Note : The tables have only 3 records. Can anyone help me in solving!

This post has been answered by Jan Gorkow on May 6 2022
Jump to Answer
Comments
Post Details
Added on May 6 2022
5 comments
84 views