The group by
clause, unlike the order by
clause, doesn’t take column ordinals. In this clause, 1
and 2
are just integer literals, and since every row of your query has the same value for these two literals, they are all grouped in to a single result row.
Instead, you should use the actual columns from your query:
GROUP BY sql_activity_days.styleship_start_month, memberCountSql."122_days"