Revision 2b688418
Von Moritz Bunkus vor mehr als 16 Jahren hinzugefügt
SL/IC.pm | ||
---|---|---|
780 | 780 |
) AS ioi ON ioi.parts_id = p.id|, |
781 | 781 |
apoe => |
782 | 782 |
q|LEFT JOIN ( |
783 |
SELECT id, transdate, 'ir' AS module, ordnumber, quonumber, invnumber, FALSE AS quotation, NULL AS customer_id, vendor_id, NULL AS deliverydate FROM ap UNION |
|
784 |
SELECT id, transdate, 'is' AS module, ordnumber, quonumber, invnumber, FALSE AS quotation, customer_id, NULL AS vendor_id, deliverydate FROM ar UNION |
|
785 |
SELECT id, transdate, 'oe' AS module, ordnumber, quonumber, NULL AS invnumber, quotation, customer_id, vendor_id, NULL AS deliverydate FROM oe |
|
786 |
) AS apoe ON ioi.trans_id = apoe.id|,
|
|
783 |
SELECT id, transdate, 'ir' AS module, ordnumber, quonumber, invnumber, FALSE AS quotation, NULL AS customer_id, vendor_id, NULL AS deliverydate, 'invoice' AS ioi FROM ap UNION
|
|
784 |
SELECT id, transdate, 'is' AS module, ordnumber, quonumber, invnumber, FALSE AS quotation, customer_id, NULL AS vendor_id, deliverydate, 'invoice' AS ioi FROM ar UNION
|
|
785 |
SELECT id, transdate, 'oe' AS module, ordnumber, quonumber, NULL AS invnumber, quotation, customer_id, vendor_id, NULL AS deliverydate, 'orderitems' AS ioi FROM oe
|
|
786 |
) AS apoe ON ((ioi.trans_id = apoe.id) AND (ioi.ioi = apoe.ioi))|,
|
|
787 | 787 |
cv => |
788 | 788 |
q|LEFT JOIN ( |
789 | 789 |
SELECT id, name, 'customer' AS cv FROM customer UNION |
Auch abrufbar als: Unified diff
Query für die Artikelstammdaten: Falsches Joinen. Wenn die UNION aus invoice/orderitems mit ar/ap/oe gejoint wird, dann muss darauf geachtet werden, dass Zeilen aus invoice nur mit ar/ap und Zeilen aus orderitems nur mit oe gejoint wird. Grund ist, dass ar.id und ap.id den Zähler glid benutzen, während oe.id den Zähler id benutzt. Daraus resultierten Verbindungen mit Zeilen aus orderitems mit Zeilen aus ar/ap, sprich es wurden Rechnungen gefunden, in denen die Artikel gar nicht auftauchten.