SELECT
t1.month,
sum(t2.sales)
FROM
(SELECT to_char(g, 'YYYY-MM') AS MONTH
FROM generate_series('2021-04-01'::date, '2022-03-31', '1 day') AS g) AS t1
LEFT JOIN
(SELECT
sales_result_data.sales,
to_char(sales_result_data.date, 'YYYY-MM') AS MONTH
FROM sales_result_data
where sales_result_data."shopId" = 138) AS t2 ON t1.month = t2.month
GROUP BY t1.month;