December 6, 2011 at 4:47 am
Hi,
I have a query that I am using to show me orphan records but for some reason the result when I run the query is coming back with no rows. Once i see the reult i want to delete them.
Select * from history where not uniqueid in (select luniqueid from linkto where lutablename = 'history' and letablename = 'contact')
I know that this result is incorrect because i can find thousands of uniqueid's that do not exist in the wce_linkto table that exist in the wce_history table if I search manually one by one.
I was wondering if it the size of my history table and the size of the linkto. There area about 2.5 million rows in each table.
I have also tried this in a small scale environment where there are just a few hundred records and it works fine.
Is there anything I can do to resolve this? Tests I can run or any other queries I can try?
Thanks for looking.
December 6, 2011 at 5:14 am
HI,
Here is the answer to my question, this query gets the results.
Select * from history h where not exists(select 1 from linkto where lutablename = 'history' and letablename = 'contact' and luniqueid =h.uniqueid )
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply