Zitat:
SQL-Code:
SELECT DISTINCT ED1.Item, ED1.Location, ED1.ItemID
FROM EnsambleD ED1
WHERE ED1.TransCode='S ' AND
NOT EXISTS (SELECT DISTINCT ED2.Itemid FROM EnsambleD ED2 WHERE ED2.Itemid=ED1.Itemid AND ED2.TransCode='EI')
Was mir hier in den Sinn kommt: Ist der
Query-Planer eigentlich intelligent genug, um zu erkennen, daß die Ergebnisliste des SubSelects eigentlich garnicht nötig ist?
SQL-Code:
SELECT DISTINCT Item, Location, ItemID
FROM EnsambleD
WHERE TransCode='S ' AND
NOT EXISTS (SELECT True FROM EnsambleD AS ED2 WHERE ED2.Itemid=EnsambleD.Itemid AND ED2.TransCode='EI' LIMIT 1)