select RIGHT("timeline".id,2) AS "timeline_day_nb_full", SUM("orderfact".quantityordered) AS "orderfact_quantityordered", SUM("orderfact".totalprice) AS "orderfact_totalprice" from PUBLIC.orderfact "orderfact", PUBLIC.timeline "timeline" where "orderfact".time_id="timeline".id AND LEFT("timeline".id,7)='2014-06' group by RIGHT("timeline".id,2) order by "timeline_day_nb_full", "orderfact_quantityordered", "orderfact_totalprice"