Results 1 to 3 of 3

Thread: Orphan records

  1. #1
    Jon Guest

    Orphan records

    I have run a NOT EXISTS query comparing a table in test and production, to determine which records have been added to the table in production so I can import those records to test. The count(*) from both tables has a difference of 766 records but the query is showing 768. I am trying to find the easiest/quickest way to identify the orphan records.

  2. #2
    Guest

    Orphan records (reply)

    Check the condition in the query. I think count(*) is giving currect results.


    ------------
    Jon at 3/14/01 1:58:50 PM

    I have run a NOT EXISTS query comparing a table in test and production, to determine which records have been added to the table in production so I can import those records to test. The count(*) from both tables has a difference of 766 records but the query is showing 768. I am trying to find the easiest/quickest way to identify the orphan records.

  3. #3
    Jun Guest

    Orphan records (reply)

    If you have ID column which exist in both table (say TableA and TableB), you can use the following query to identify the records exist in TableA but not in TableB.

    /****************/

    SELECT *
    FROM TableA
    WHERE id NOT IN
    (SELECT id FROM TableB )

    /***********************/

    Hope this helps.

    Jun

    ------------
    Jon at 3/14/01 1:58:50 PM

    I have run a NOT EXISTS query comparing a table in test and production, to determine which records have been added to the table in production so I can import those records to test. The count(*) from both tables has a difference of 766 records but the query is showing 768. I am trying to find the easiest/quickest way to identify the orphan records.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •