CodeIgniter Forums
Need Help - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Need Help (/showthread.php?tid=9145)



Need Help - El Forum - 06-13-2008

[eluser]nandish[/eluser]
Hi guys

Want to update two tables in mysql using single query.

update tbl1,tbl2 set tbl1.field ='aaa',set tbl2='bbb' where tbl.field ='ccc' AND tb2.field ='ccc'

I used above format but its giving error.

Thanks



Need Help - El Forum - 06-14-2008

[eluser]Nikhil Vijayan[/eluser]
The query doesn't make sense where does tbl and tb come from there is only tbl1 and tbl2

or is it typo mistake .. whetever correct one is

Quote:update tbl1,tbl2 set tbl1.field =’aaa’,tbl2.field=’bbb’ where tbl1.field =’ccc’ AND tbl2.field =’ccc’

if it doesn't work try this

Quote:update tbl1,tbl2 set tbl1.field =’aaa’,tbl2.field=’bbb’ where tbl1.field = tbl2.field AND tbl1.field =’ccc’