Multi-table write with single query - is it possible? |
[eluser]seanloving[/eluser]
I can perform a multi-table read like this... Code: $this->CI->db Thanks Sean Loving
[eluser]Sinclair[/eluser]
I have done it in SQL Server, using Views with "Instead" Triggers. In MySQL I never done it.
[eluser]danmontgomery[/eluser]
Same way you do a select. http://dev.mysql.com/doc/refman/5.0/en/update.html Code: UPDATE table1 LEFT JOIN table2 ON table2.table1_id = table1.id SET table1.value1 = "Some Value", table2.value2 = "Some Other Value" WHERE table1.value3 = "Some Third Value"; I don't believe active record supports joins in update statements, however.
[eluser]seanloving[/eluser]
[quote author="noctrum" date="1266372163"]Same way you do a select. http://dev.mysql.com/doc/refman/5.0/en/update.html Code: UPDATE table1 LEFT JOIN table2 ON table2.table1_id = table1.id SET table1.value1 = "Some Value", table2.value2 = "Some Other Value" WHERE table1.value3 = "Some Third Value"; I don't believe active record supports joins in update statements, however.[/quote] Since active record can't, this is what I need. Thanks! |
Welcome Guest, Not a member yet? Register Sign In |