Code: Alles auswählen.
select * from ZGH_PART into table @data(zghPartners)
where begda <= @stichtag and exist = '2'
order by partnr ascending, begda descending.
delete adjacent duplicates from zghPartners comparing partnr.
loop at zghPartners assigning field-symbol(<p>).
write:/ <p>-partnr, <p>-begda, <p>-endda.
endloop.
GrußD.h. der aktuellste Datensatz mit exist = '2' aller Partnr' soll zurückgegeben werde,
Code: Alles auswählen.
select * from ZGH_PART into table @data(zghPartners)
where exist = '2'
AND begda = SELECT( MAX(begda) FROM ZGH_PART
WHERE begda <= @stichtag
AND PARTNR = ZGH_PART-PARTNR ).
loop at zghPartners assigning field-symbol(<p>).
write:/ <p>-partnr, <p>-begda, <p>-endda.
endloop.
Code: Alles auswählen.
...MAX( begda )...
Code: Alles auswählen.
...AND PARTNR = ZGH_PART-PARTNR ).
Code: Alles auswählen.
select * from ZGH_PART into table @data(zghPartners)
where exist = '2'
AND begda = ( SELECT MAX( begda ) FROM ZGH_PART
WHERE begda <= @stichtag
AND PARTNR = ZGH_PART~partnr
and exist = '2' ).
loop at zghPartners assigning field-symbol(<p>).
write:/ <p>-partnr, <p>-begda, <p>-endda.
endloop.