Hier so wie ich es probiert habe:
Delphi-Quellcode:
SELECT A.ABFDocErfNr,A.ABFDocKundenNr,B.ABFPosArtNr,B.ABFPosName1
FROM ABFPos AS B
INNER JOIN ABFDok AS A ON B.ABFPosDocId = A.ABFDocID
where A.ABFDocErfNr like 'O*' and B.ABFPosType = 0 and A.ABFDocKundenNr = 'D018543'
where not exists (SELECT A.ABFDocErfNr,A.ABFDocKundenNr,B.ABFPosArtNr,B.ABFPosName1
FROM ABFPos AS B
INNER JOIN ABFDok AS A ON B.ABFPosDocId = A.ABFDocID
where A.ABFDocErfNr like 'R*' and B.ABFPosType = 0 and A.ABFDocKundenNr = 'D018543'
)
LG Harry