|Subject||Re: Need some SQL help|
> The data sample (there may be more than one pair of OB/CB, becauseHooray Riho-Rene, you may have several pairs per day, but only one pair for each currency on that day. That was the bit that was needed to write this statement:
> of different currencies).
SELECT SDATE, CURRENCY
FROM STATEMENT S1
WHERE S1.OPTYPE = 'OB'
AND NOT EXISTS(SELECT * FROM STATEMENT S2
WHERE S2.SDATE = S1.SDATE
AND S2.CURRENCY = S1.CURRENCY
AND S2.OPTYPE = 'CB')
Of course, this will take a little bit of time to run.