1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| SELECT
DISTINCT
49, a.id, b.id, 0,0,1 FROM ct_account a, ct_0000_ga1 b, ct_0000_0dplcr c where b.id not in (select c1.ct_0000_origa from ct_0000_0dplcr c1 where
a.id = c1.ct_0000_origsa )
and b.id not in (select c2.ct_0000_origa from ct_0000_0dplcr c2 where
c2.ct_0000_origsa = (select id from ct_account where name='NA') and c2.ct_0000_orisequence = (select ct_0000_sequence from ct_account where id=a.id)
)
;
J'ai cru que le problème venait de l'utilisation de l'opérateur "not in", j'ai donc réécrit la requête avec un opérateur "not exists" comme cela :
INSERT
INTO [FUNCTION_TABLE]
( fncode, fnarg1, fnarg2, fnarg3, fnarg4, fnvalue ) SELECT
DISTINCT
[FUNCTION_CODE], a.id, b.id, 0,0,1 FROM ct_account a, ct_0000_ga1 b, ct_0000_0dplcr c where not exists (select * from ct_0000_0dplcr c1 where
a.id = c1.ct_0000_origsa and b.id = c1.ct_0000_origa )
and not exists (select * from ct_0000_0dplcr c2 where
c2.ct_0000_origsa = (select id from ct_account where name='NA') and c2.ct_0000_orisequence = (select ct_0000_sequence from ct_account where id=a.id) and b.id = c2.ct_0000_origa
) |
Partager