I’m complete novice in sql queries. I have two tables:
table1:
id_s name post_code city subject
------------------------------------------
1 name1 postal1 city1 subject1
2 name2 postal2 city2 subject2
3 name3 postal3 city3 subject3
4 name4 postal4 city4 subject4
...
~350
table2:
id_p name post_code city subject
------------------------------------------
1 name1 postal1 city1 subject1
2 name2 postal2 city2 subject2
3 name3 postal3 city3 subject3
4 name4 postal4 city4 subject4
...
~1200
I want to join both tables, and remove entries with same name and postal code. I found some answers on how to do it but they were too complicated.
You can use
UNIONclause,UNIONwill check for duplicates and only distinct rows will be returnedEdit: To store data from both table without duplicates, do this
This will insert rows from table2 that do not match name, postal code from table1
Alternative is that You can also create new table and not touch table1 and table2