I want to bucket the total quantity sold in Postgres and somehow I managed to retrieve my data from the tables using CTE\'s and joins, but still, there are two problems: