mysql - Clone tables including more than one pk -
i'd clone table onto these statements:
insert clone_table1 select alias.* table1 alias inner join table2 b on alias.pidm = b.user alias.pidm "2016%" , b.userstate = 30;
yes work well, until there more 1 alias.pidm
on table1
.
table1:
id | pidm | field1 | field2 --------------------------- 1 | 5 | aa | bb 2 | 5 | cc | dd 3 | 5 | ee | ff
table2:
user | field1 | userstate ------------------------- 5 | kk | 30 6 | jj | 40
so, field can identify each other between table1.pidm
, table2.user
.
so question is: how can insert where table1.pidm=5 , table2.userstate=30
rows clone_table1
?
thanks in advance.
insert clone_table1 select alias.* table1 alias left join table2 b on alias.pidm = b.user , b.userstate = 30 alias.pidm "2016%"
Comments
Post a Comment