Aug 29, 2018 12:49 AM|kengkit|LINK
I have found a solution by referring your suggestion. The following sql statement work as expected. TQ
* i put x.Month = y.Month at the end.
select *,(select top 1 CollectedAmount from (SELECT MONTH(paid_date) as Month, SUM(paid_amt) as CollectedAmount FROM loan_general GROUP BY MONTH(paid_date) ) as l where l.[Month]=x.Month) as CollectedAmount
(SELECT MONTH(start_date) as Month, COUNT(ID) as Count, SUM(capital) as CapitalAmount FROM customer_account GROUP BY MONTH(start_date)) as x WHERE x.month = y.month