mysql - Error in SQL query (SQL update) -


the query :

update t1 set t1.paper_attempt = 1 table1 t1 join table2 t2 on t2.user_id = t1.user_id join table3 t3 on t3.id = t2.company_id t3.candidate_id = 'cand024'; 

i using heidisql, on running query, showing syntax error. please help!

your syntax doesn't work in mysql.

the common multi-table update query is:

update [low_priority] [ignore] table_list set col_name1={expr1|default} [, col_name2={expr2|default}] ... [where where_condition] 

i.e. query should rewritten as:

update table1 t1,         table2 t2,         table3 t3 set  t1.paper_attempt = 1  t2.user_id = t1.user_id         , t3.id = t2.company_id         , t3.candidate_id = 'cand024'; 

also can use subquery:

update table1 t1 set  t1.paper_attempt = 1  t1.user_id in (        select t2.user_id        table2 t2        join table3 t3 on (t3.id = t2.company_id)        t3.candidate_id = 'cand024' ); 

Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -