Hi,
I have a table named LIMSVERSIONS which links to 5 other table with the VERSIONID field.
There is a lot of data in LIMSVERSIONS table (about 20000 rows) and I need to remove all the orphan rows in that table. I tried this way :
delete from MYVERSIONS
where VERSIONID in (
select VER.VERSIONID
from LIMSVERSIONS VER
left outer join LIMSXFDFORMS FRM ON VER.VERSIONID = FRM.VERSIONID
left outer join LIMSSERVERSCRIPTS SSC ON VER.VERSIONID = SSC.VERSIONID
left outer join LIMSDATASOURCES DS ON VER.VERSIONID = DS.VERSIONID
left outer join LIMSCLIENTSCRIPTS CSC ON VER.VERSIONID = CSC.VERSIONID
where FRM.ORIGREC IS NULL
and SSC.ORIGREC IS NULL
and DS.ORIGREC IS NULL
and CSC.ORIGREC IS NULL)
But there is too many rows ("IN" only support 1000 max) and its really slow.
Anybody have a clue?
Thanks
I have a table named LIMSVERSIONS which links to 5 other table with the VERSIONID field.
There is a lot of data in LIMSVERSIONS table (about 20000 rows) and I need to remove all the orphan rows in that table. I tried this way :
delete from MYVERSIONS
where VERSIONID in (
select VER.VERSIONID
from LIMSVERSIONS VER
left outer join LIMSXFDFORMS FRM ON VER.VERSIONID = FRM.VERSIONID
left outer join LIMSSERVERSCRIPTS SSC ON VER.VERSIONID = SSC.VERSIONID
left outer join LIMSDATASOURCES DS ON VER.VERSIONID = DS.VERSIONID
left outer join LIMSCLIENTSCRIPTS CSC ON VER.VERSIONID = CSC.VERSIONID
where FRM.ORIGREC IS NULL
and SSC.ORIGREC IS NULL
and DS.ORIGREC IS NULL
and CSC.ORIGREC IS NULL)
But there is too many rows ("IN" only support 1000 max) and its really slow.
Anybody have a clue?
Thanks