mysql pdo update record using LEFT JOIN -
"update tablename1 t1 left join tablename2 t2 on t1.pin = t2.pin , t1.status = t2.status left join tablename3 t3 on t1.pin = t3.pin , t1.status = t3.status left join tablename4 t4 on t1.pin = t4.pin , t1.status = t4.status left join tablename5 t5 on t1.pin = t6.pin , t1.status = t6.status left join tablename6 t6 on t1.pin = t6.pin , t1.status = t6.status left join set t1.status = : status, t2.status = : status, t3.status = : status, t4.status = : status, t5.status = : status, t6.status = : status t1.pin = : pin , t1.status = : active "
this query updating multiple tables @ same time. of tables might empty used left join
update table values. got error near 'set t1.status = 'notactive' , t2.status = 'n' @ line 7'
did change ,
and
still error , when search error uncaught exception 'pdoexception' message 'sqlstate[42000]
of things found appears when there reserved word
. far concern there no reserve word in code.
any suggestion appreaciated
update tablename1 t1 left join tablename2 t2 on t1.pin = t2.pin , t1.status = t2.status left join tablename3 t3 on t1.pin = t3.pin , t1.status = t3.status left join tablename4 t4 on t1.pin = t4.pin , t1.status = t4.status left join tablename5 t5 on t1.pin = t6.pin , t1.status = t6.status left join tablename6 t6 on t1.pin = t6.pin , t1.status = t6.status left join ???? set t1.status = : status, t2.status = : status, t3.status = : status, t4.status = : status, t5.status = : status, t6.status = : status t1.pin = : pin , t1.status = : active
what last left join ???? left joining on set part ?
i think have typo on line:
tablename5 t5 on t1.pin = t6.pin , t1.status = t6.status left join
i think mean closer this:
update tablename1 t1 left join tablename2 t2 on t1.pin = t2.pin , t1.status = t2.status left join tablename3 t3 on t1.pin = t3.pin , t1.status = t3.status left join tablename4 t4 on t1.pin = t4.pin , t1.status = t4.status left join tablename5 t5 on t1.pin = t5.pin , t1.status = t5.status left join tablename6 t6 on t1.pin = t6.pin , t1.status = t6.status set t1.status = : status, t2.status = : status, t3.status = : status, t4.status = : status, t5.status = : status, t6.status = : status t1.pin = : pin , t1.status = : active
Comments
Post a Comment