PDA

View Full Version : Hilfestellung bei AS/400 SQL Anweisung



Luisfree
19-01-05, 17:32
Wenn in der Datei A die nachfolgenden Bedingungen zutreffen, möchte ich (per SQL) Sätze in die Datei B schreiben:<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>

<o:p> </o:p>

Bedingungen Datei A:<o:p></o:p>

FIRMA = 2 (4-stellig num.)<o:p></o:p>

AND HND = ’AB01’ (4-stellig alpha) <o:p></o:p>

<o:p> </o:p>

<o:p> </o:p>

WRITE Datensatz in die Datei B:<o:p></o:p>

FIRMA (Datei A) à FIRMA (Datei B) - (4-stellig num.)<o:p></o:p>

ADR (Datei A) à ADR (Datei B) - (8-stellig num.)<o:p></o:p>

à SPART ’V’ (Datei B) - (5-stellig alpha)<o:p></o:p>

à VTR ’20’ (Datei B) - (4-stellig num.) <o:p></o:p>

Fuerchau
19-01-05, 17:42
update filea a (feld1, feld2, ...) (select b.feld1, b.feld2 ... from dateib b where a.key1=b.key1 and a.key2 = b.key2 and ...)
where a.key1 concat a.key2 in (select c.key1 concat c.key2 from dateib c where a.key1=c.key1 and a.key2 = c.key2 and ...)

Die Syntax müsste ungefähr so stimmen.

Übrigens mein SQLCPY löst genau solche Aufgaben einfach und schnell.