I have two tables as shown below.
table1
site | Link type
-----+----------
A | pdf
B | html
C | NULL
D | NULL
Table2
site | link type
-----+----------
C | htm
D | doc
This is the result I want:
site | link type
-----+----------
A | pdf
B | html
C | htm
D | doc
I want an insert query to insert the values of link type from table 2 to table 1
where link type is null joined with the condition with of table1.site = table2.site
.
I tried:
INSERT INTO table1(linktype)
SELECT linktype FROM table1 t1
JOIN table2 t2
ON t1.site=t2.site
I want a insert query. as update query is working and want to know how a insert can be done?