Postgres SQL查询正在执行,即使两个group by子句中均不存在某些列且未对其进行汇总
select
BO.job_number,
BO.id,
BO.INVOICE,
BO.ORDER_DATE,
BO.INV_DATE,
BO.TRACK_NO,
BO.DELIVER_CODE,
BO.ship_to_customer_id,
BO.INVOICECUST_CODE,
BO.bill_to_customer_id,
OL.PROD_CODE,
OL.product_custom_id,
OL.PRODTYPE,
sum(quantity) as QTY,
sum(before_tax_amount) as INV_VALUE,
sum(before_tax_amount) + sum(tax_amount) as INVOICE_VAULE_WITH_TAX,
sum(discount_amount) as discount_amount,
BO.COMMENT, BO.source_code,
BO.route_to ,
BO.reference
from
BO
inner join
OL on BO.id = OL.order_id
left join
bulkroutsalord on BO.id = bulkroutsalord.sales_order_id
group by
BO.job_number, BO.id, ol.product_code, ol.product_custom_id,
ol.product_type, bulkroutsalord.destination_code
请帮助我了解它的工作原理