# Related Sites > SQL Course >  Finding orphaned records

## mattarm

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

----------


## Claire

select b.* from Parent a right outer join Child b on a.CommanCol = b.CommonCol where a.Commoncol is null

----------


## mattarm

Thank you Claire,

I am forever in your debt  :Wink: 

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

----------


## mattarm

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

----------


## Claire

Not a problem, knowledge is refreshed by sharing

----------

