MySQL Forums
Forum List  »  Newbie

SQL Syntax Question
Posted by: Jeremy Shivers
Date: September 01, 2004 12:02PM

Hello,
I am using MySQL 4.0.20 standard on Linux 2.4.20. I have two InnoDb tables within a database. I was wondering how to return a certain query. I am somewhat familiar with SQL though I am not sure how to go about solving this. I was reading the manual on how you could accomplish this with sub-queries although its only implemented in >= 4.1.0. I plan on upgrading in the near future, so if this can be solved more effciently in another version writing it a different way, I'll look into it.

I have two tables, t1 and t2. They contain one column each with the same column name. They both contain the exact records except that t2 has t1 - x records where x is the number of records less than t1 has. My question is, how do I only show the records that exist in both tables and to show and delete the records from t1 that is not in t2.

For example, I have records 1, 2, 3 in t1. I only have records 1, 2 in t2. What statement can I execute to select and delete the records from t1 that do not exist in t2?

Sorry if I am not being very clear. Any help is appreciated.

J. Shivers

Options: ReplyQuote


Subject
Written By
Posted
SQL Syntax Question
September 01, 2004 12:02PM
September 01, 2004 02:53PM
September 01, 2004 03:05PM
September 01, 2004 03:08PM


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.