Hm, I don't get it. We've got the following query and want to remove the nested joins:
SELECT v.*
FROM tbl_Vorgabe v
INNER JOIN tbl_Vorgabe2VorgabeBaustein v2v_bu
ON v.lngPK_Vorgabe = v2v_bu.lngFK_Vorgabe
INNER JOIN tbl_VorgabeBausteinBU bu
ON bu.lngPK_VorgabeBaustein = v2v_bu.lngFK_VorgabeBaustein
LEFT OUTER JOIN tbl_Vorgabe2VorgabeBaustein v2v_kapital
INNER JOIN tbl_VorgabeBausteinKapital kapital
ON v2v_kapital.lngFK_VorgabeBaustein = kapital.lngPK_VorgabeBaustein
ON v2v_bu.lngFK_Vorgabe = v2v_kapital.lngFK_Vorgabe
-- LEFT OUTER JOIN tbl_Vorgabe2VorgabeBaustein v2v_kapital
-- On V.lngPK_Vorgabe = v2v_kapital.lngFK_Vorgabe
-- INNER JOIN tbl_VorgabeBausteinKapital kapital
-- On v2v_kapital.lngFK_VorgabeBaustein = kapital.lngPK_VorgabeBaustein
-- AND v2v_bu.lngFK_Vorgabe = V.lngPK_Vorgabe
WHERE v2v_kapital.lngPK_Vorgabe2VorgabeBaustein IS NULL
The table relations are:
- 1 Vorgabe : n Vorgabe2Vorgabebaustein,
- n Vorgabe2VorgabeBaustein : 1 VorgabeBaustein(Kapital/BU)
The lines which are commented out are our approach to rewrite the nested joins. This can't work. We're starting to believe that we MUST use nested joins. But we would be happy to be convinced of the contrary!
Thanks in advance for your suggestions and time!