sql - MySQL Insert from another table with 2 option WHERE statement -
i have done research can not figure out how this. super simple insert table want include statements.
i want insert value of single column, column_q table table b's column_q table a's column_w = '100' , column_q not exist in table b.
i tried:
insert b (column_q) select distinct(column_q) column_w = 100 , b.column_q<>a.column_q;
where doing wrong?
ps. both tables contain values. no field null.
insert b (q) select distinct q a.w = 100 , a.q not in ( select q b )
if b.q
has unique
constraint defined on it, use:
insert ignore b (q) select q w = 100
Comments
Post a Comment