select "products".productline AS "products_line", "products".productname AS "products_name", "products".productscale AS "products_scale", TO_CHAR(substr("products".productdescription, 1, 4000)), SUM("orderfact".quantityordered) AS "orderfact_quantityordered" from PUBLIC.orderfact "orderfact", PUBLIC.products "products", PUBLIC.timeline "timeline" where "orderfact".productcode="products".productcode AND "orderfact".time_id="timeline".id AND  ("timeline".id <= NOW()) group by "products".productline, "products".productname, "products".productscale, TO_CHAR(substr("products".productdescription, 1, 4000)) order by "products_line", "products_name", "products_scale", "orderfact_quantityordered"