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!