Home » RDBMS Server » Server Administration » Re: Finding Orphan Records
Re: Finding Orphan Records [message #373114] Wed, 28 March 2001 05:48
kavithask
Messages: 34
Registered: March 2001
Location: London
Member
Hi,

If you use a Sub-query using NOT IN or NOT EXISTS, it should list the rows that are not found in the parent table.

SELECT *
FROM table_b
WHERE col1 NOT IN (
SELECT parent_col1
FROM table_a
);

Or you can use an outerjoin and find the rows which return NULL Values for parent columns.

HTH
Kavitha
Previous Topic: Help on crosstab query for oracle
Next Topic: RE:OCP EXAM
Goto Forum:
  


Current Time: Sat Jun 29 00:22:06 CDT 2024