MySQL Forums
Forum List  »  Newbie

SQL Help- Creating a table that includes only records that exist in one table without existing in another
Posted by: Victoria Vigil
Date: December 22, 2013 03:10PM

I'm a newbie here and hoping someone can help with this sql. I've created two tables, one of which holds EVERY record, another which contains the records that I DON'T want in my table.
I tried joining them in the way I researched that is supposed to work, to include only records where they ARE NOT In the second table, but I'm getting an error.
The SQL is:

Create table t3 as
(Select *
from t1
Left Outer join t2 on (t1.ID = t2.Orig_ID and t1.ID_Line = t2.Orig_ID_Line)
Where t2.Orig_ID is null
and t2.Orig_ID_Line is null)

This should be simple. However, i'm getting an error that says "Duplicate column name in Orig_ID"

HELP!
Thanks.

Options: ReplyQuote


Subject
Written By
Posted
SQL Help- Creating a table that includes only records that exist in one table without existing in another
December 22, 2013 03:10PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.