Results 1 to 5 of 5

Thread: Finding orphaned records

  1. #1
    Join Date
    Mar 2004
    Posts
    9

    Finding orphaned records

    I am trying to find records that are orphaned in a data base after thier parent record (in another table) has been deleted.

    Something happened to the constraints and I had no idea until now this had happened.

    I have the faint rustle of a query in query sort of thing but my knowledge needs expansion.

    Thanks,
    Matt

  2. #2
    Join Date
    Mar 2003
    Location
    NJ
    Posts
    201
    select b.* from Parent a right outer join Child b on a.CommanCol = b.CommonCol where a.Commoncol is null

  3. #3
    Join Date
    Mar 2004
    Posts
    9
    Thank you Claire,

    I am forever in your debt

    Some days I think I have grasped SQL but then fate sends me a curve ball that hits exactly where my knowledge is lacking.

    a day in which you learn something new is a day well spent.

    Thanks Matt

  4. #4
    Join Date
    Mar 2004
    Posts
    9
    Just a few additional thougts.

    I had no idea that you could use a check for null without any actual data. This little gem will be locked away in the memory bank for future reference - at least untill I forget it.

    Thanks again Claire.
    Matt

  5. #5
    Join Date
    Mar 2003
    Location
    NJ
    Posts
    201
    Not a problem, knowledge is refreshed by sharing

Posting Permissions

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