Einzelnen Beitrag anzeigen

Ykcim

Registriert seit: 29. Dez 2006
Ort: NRW
804 Beiträge
 
Delphi 10.4 Sydney
 
#3

AW: Update mit Werten aus der gleichen Tabelle und anderen Tabellen

  Alt 29. Jul 2019, 17:09
Ok, ich habe es jetzt so versucht:
Delphi-Quellcode:
update as400 as b
set b.oaagbz=t.Bezeichnung from
    (select concat(a.oaagbz,' HN.',Right(p.stkomp,3),' ', t.azabme) as Bezeichnung from as400 a
      left join phstru p on p.stbgnr=a.watenr and p.tamagr=3500
      left join teilestamm t on t.aztenr=p.stkomp
      where a.oamanr like 'SU%'
      and t.temagr=3500
      and p.tamagr=3500
     group by a.watenr) as t
where b.waaunr=t.waaunr and b.waaupo=t.waaupo and b.oaagnr=t.oaagnr
Aber da gefällt ihm auch noch etwas nicht:
Delphi-Quellcode:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from
(select concat(a.oaagbz,
' HN.',Right(p.stkomp,3),' ', t.azabme) as Bezeich' at line 2
Patrick
  Mit Zitat antworten Zitat