I'm trying to select distinct values from master table and repeated values from child tables. I have 4 tables:
- invoice
- invoiceLine
- product
- businessPartner
My query:
select c_invoice.c_invoice_ID, c_bpartner.name as "Business Partner", M_Product.name as "Product", c_invoiceline.priceentered as "amount" from adempiere.c_invoice left join adempiere.c_invoiceline on c_invoice.c_invoice_ID=c_invoiceline.c_invoice_ID left join adempiere.M_Product on c_invoiceline.M_Product_ID =M_Product.M_Product_ID left join adempiere.C_BPartner on c_invoice.c_bpartner_ID=c_bpartner.c_bpartner_id where c_invoice.sh_booking_ID=1000019 and c_invoice.c_doctypetarget_id=1000005 My query result:
INVOICEID BUSINESS Partner PRODUCT AMT 1000005; "Tehmoor"; "Charge 1"; 1200 1000005; "Tehmoor"; "Standard"; 1500 1000006; "Rafay"; "Charge 1"; 1200 1000006; "Rafay"; "Standard"; 1100 and expected result
INVOICEID BUSINESS Partner PRODUCT AMT 1000005; "Tehmoor"; "Charge 1"; 1200 ; NULL; "Standard"; 1500 1000006; "Rafay"; "Charge 1"; 1200 ; NULL; "Standard"; 1100