我假设您要查找的是count为0的行。如果是这种情况,则可以在表中使用generate_series和左连接并添加数据:
SELECt to_char(i, 'YY'), to_char(i, 'MM'), count(id) FROM generate_series(now() - INTERVAL '1 year', now(), '1 month') as i left join users on (to_char(i, 'YY') = to_char(created_date, 'YY') and to_char(i, 'MM') = to_char(created_date, 'MM') and login_type = 1) GROUP BY 1,2;



