1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
|
select * from table1
where
(cdsg,RADIC,SERIE,NORDR,CDMONN,DATOPER,NOPER,COPER) in
(
select cdsg,RADIC,SERIE,NORDR,CDMONN,DATOPER,NOPER,COPER
from
(select cdsg,montant,RADIC,SERIE,NORDR,CDMONN,DATOPER,NOPER,COPER,count(flag)
over(partition by cdsg,montant order by datoper,noper) nbr
from table1 where
COPER = 'W22' and
cdsg = 457 and
radic =777125 and
serie =587 and
datoper ='23/05/2006' and
noper =173 and
(cdsg,montant) in (select cdsg,montant*-1 from
table1 where coper='RTD'
and flag=1)
)
where nbr=1 |
Partager