Hallo Zusammen.
Ich hab in SQL nur Grundkenntnisse welche ich mir selbst beigebracht habe. Deshalb mache ich wahrscheinlich Fehler, welche einen Profi nie passieren.
Mein Probleme ist ein Update einer Zelle, wo ich für den benötigten Wert über 5 Tabellen gehen muss. (Erste Unterabfrage). Die betroffenen Zellen muss ich ebenfalls über eine Unterabfrage ermitteln. Die Unterabfragen liefern eindeutige Werte. Trotzdem bekomme ich die Fehlermeldung: Unterabfrage für eine Zeile liefert mehr als eine Zeile
Wahrscheinlich mache ich bei dem Code grundsätzlich was falsch.
update tab1
set tab1.id5 =
(
select tab5.id5
from tab1, tab2, tab3, tab4, tab5
where tab1.id1 = tab2.id1
and tab2.id2 = tab3.id2
and tab3.id3 = tab4.id3
and tab4.id4 = tab5.id4
)
where tab1.id1 in
(
select tab1.id1
from tab1, tab2, tab3, tab6, tab7
where tab1.id1 = tab6.id1 (+)
and tab1.id1 = tab2.id1
and tab2.id2 = tab3.id2
and tab3.id3 = tab7.id3
and tab6.id1 is null
and tab1.id5 in ('WERT1','WERT2')
and tab1.id6 in ( 'WERT3','WERT4')
and (tab3.id7 / tab7.id7) < 10
)
Bitte um Hilfe. Vielen Dank.
Ich hab in SQL nur Grundkenntnisse welche ich mir selbst beigebracht habe. Deshalb mache ich wahrscheinlich Fehler, welche einen Profi nie passieren.
Mein Probleme ist ein Update einer Zelle, wo ich für den benötigten Wert über 5 Tabellen gehen muss. (Erste Unterabfrage). Die betroffenen Zellen muss ich ebenfalls über eine Unterabfrage ermitteln. Die Unterabfragen liefern eindeutige Werte. Trotzdem bekomme ich die Fehlermeldung: Unterabfrage für eine Zeile liefert mehr als eine Zeile
Wahrscheinlich mache ich bei dem Code grundsätzlich was falsch.
update tab1
set tab1.id5 =
(
select tab5.id5
from tab1, tab2, tab3, tab4, tab5
where tab1.id1 = tab2.id1
and tab2.id2 = tab3.id2
and tab3.id3 = tab4.id3
and tab4.id4 = tab5.id4
)
where tab1.id1 in
(
select tab1.id1
from tab1, tab2, tab3, tab6, tab7
where tab1.id1 = tab6.id1 (+)
and tab1.id1 = tab2.id1
and tab2.id2 = tab3.id2
and tab3.id3 = tab7.id3
and tab6.id1 is null
and tab1.id5 in ('WERT1','WERT2')
and tab1.id6 in ( 'WERT3','WERT4')
and (tab3.id7 / tab7.id7) < 10
)
Bitte um Hilfe. Vielen Dank.