Which DBMS are you using? I'm assuming MySQL for my reply...
anakadote;10993241 wrote:Can you just do the join by 'name', and then use PHP to compare the results, as opposed to relying on an SQL query to do so?
You could, but why bother? Heck, you could store all of the data in flat files and just use PHP to manipulate all of it... but again, why bother? :p
@: What does it mean for a column to "exist" in one table but not the other? If an item exists in both table_1 and table_2, it's going to have a value for all columns in both tables.
Is the default value NULL for the columns in table_2? In other words, by "not exist" did you really mean "contain the NULL value" ? If that's the case, then you could simply use COALESCE() on each column pair between the two tables, making sure to list the column in table_2 before the one in table_1.
EDIT: Forgot to discuss the JOIN involved; can you elaborate more on which data you're wanting? Do you want all of table_2, all of table_1, only items that are contained in both tables, or all items (e.g. items from both table_1 and table_2)?