How can you compare two tables (the second table from the dump) and output the rows that are not in the first (which is in the second) using SELECT
- Are there unique identifiers for strings of type id? what fields are there? - Denis
- id, human_id - these are the fields - Mitchell Cameron
|
3 answers
You can make a JOIN
both tables on the id
field, and then select only those records that are not in the first table. For example:
SELECT d.* FROM dump_data d LEFT OUTER JOIN real_data r ON r.id = d.id WHERE r.id IS NULL
|
I would advise to use tools like dbForge Studio
, which are able to do migration scripts and similar things. Even in the free version. If you certainly do not write a bicycle.
|
I do not quite understand where the id
fields are, where human_id
, but try this:
select * from table2 where id not in (select id from table1)
|