mysql noob here; looked around first couldn't find answer question.
so have 2 tables in mysql, 1 (table1) consists of 1 column containing unique list of names (col1) , containing corresponding binary values (col2). second table (table2) contains list of recurring names empty column waiting filled binary values first table. want is, each instance of recurring name in table2, insert binary value col2 associated matching unique name in table1.
i know how in excel—you place following vlookup statement next every row containing recurring name. in following code snippet a2 recurring name, unique names contained in column b, , binary values contained in column c.
=vlookup(a2,$b$2:$c$106095,2,false)
but can't life of me figure out how reproduce effect in mysql. can't use excel because there's data. have ideas? in advance!
i think want (i don't know excel statement does):
update table2 join table1 on table1.col1 = table2.col1 set table2.col2 = table2.col2 table2.col2 null
this update each row table2
has col2
empty, searching corresponding row in table1
based on matching col1
columns.
btw, have reason this? why not join both tables when selecting data? example:
select table2.col1, table1.col2 table2 join table1 on table1.col1 = table2.col1
Comments
Post a Comment