我使用下面的sql加入DRAT& DRAP。
SELECT * INTO CORRESPONDING FIELDS OF WA_DOC_LOG
FROM DRAP
INNER JOIN DRAT ON DRAP~DOKNR = DRAT~DOKNR
AND DRAP~DOKAR = DRAT~DOKAR
WHERE DRAP~DOKNR IN S_DOKNR
AND DRAP~DOKAR IN S_DOKAR
AND DRAP~DOKST IN S_DOKST
AND DRAP~DATUM IN S_DATUM.
但是当我显示时,我只想显示具有最高版本号(DRAP~DOKVR)的记录。用较低版本消除记录的可能方法是什么?
答案 0 :(得分:0)
我可能会off-load this to the application server:
SORT documents BY dokar doknr dokvr DESCENDING. " careful with doktl!
DELETE ADJACENT DUPLICATES FROM documents COMPARING dokar doknr.
使用SQL来实现这一点可能是可能的,但我会非常小心,因为除非做得好,否则这可能会相当昂贵。
答案 1 :(得分:0)
尝试以下SELECT语句:
SELECT *
INTO CORRESPONDING FIELDS OF TABLE WA_DOC_LOG
FROM DRAP AS d
INNER JOIN DRAT AS t
ON d~DOKNR = t~DOKNR
AND d~DOKAR = t~DOKAR
WHERE d~dokvr = ( SELECT max( dokvr ) FROM drap ).
虽然它效率不高,但功能尚未实现。您应该自己考虑在混凝土系统上的性能。