Filter: SQL, UPDATE
Is there a way to do the following in one single statement? I know I can
get all of the info from the three tables in a single query using
joins...
// Start a transaction
conn.setAutoCommit(false);
// Do the work.
stmt = conn.createStatement();
// Update general acct info
sSQL = "UPDATE t_account " +
"SET fkCustomerId=" + cdVO.getIdCustomer() + ", " +
"dateCreated=" + cdVO.getDateCreated() + ", " +
"dateClosed=" + cdVO.getDateClosed() + ", " +
"balance=" + cdVO.getBalance() + " " +
"WHERE id=" + cdVO.getIdAccount() + ";";
stmt.executeUpdate(sSQL);
// Update investment specific acct info
sSQL = "UPDATE t_accountinvestment " +
"SET investmentObjective=" + cdVO.getObjective() +" " +
"WHERE id=" + cdVO.getIdAccount() + ";";
stmt.executeUpdate(sSQL);
// Update cd specific acct info
sSQL = "UPDATE t_accountcd " +
"SET dateMaturity=" + cdVO.getDateMaturity() + ", " +
"isDivReinvested=" + cdVO.getIsDivReinvested() + " " +
"WHERE id=" + cdVO.getIdAccount() + ";";
stmt.executeUpdate(sSQL);
conn.commit();
Thanks,
David
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php