boyboylay Posted August 8, 2013 Share Posted August 8, 2013 is it possilbe to update two tables using the same code from Chapter 12 "Updating Data in a Databse"? if it is possible, can you teach me how to do it? for example.. TABLE 1 recordid.. name...basicinfo TABLE 2 recordid...login... password Link to comment Share on other sites More sharing options...
HartleySan Posted August 8, 2013 Share Posted August 8, 2013 You can't update two tables in a single statement, but you can do two separate statements. If you need both to either succeed together or fail together, you can use a transaction. Link to comment Share on other sites More sharing options...
Larry Posted August 9, 2013 Share Posted August 9, 2013 I could be wrong about this, but I believe you actually can update two tables (or more) with one statement using a JOIN. It's not something I've had to do, but I think it's possible. Link to comment Share on other sites More sharing options...
HartleySan Posted August 9, 2013 Share Posted August 9, 2013 Yes, Larry, you are right. After doing some more research, I found several articles on the topic, including this one: http://stackoverflow.com/questions/8851974/updating-multiple-tables-in-a-single-sql-statement With that said, I wouldn't normally do it. Link to comment Share on other sites More sharing options...
Recommended Posts