My App updates two tables at once(username from accounts and orders), but if second tables does not contain the same record(no orders) then it only updates first table(accounts)
This code works, but I am trying to merge them into a single string
' Multi: True = Update Both Tables
' Multi: False= Update Single Table
If Multi = True Then
SQL = "UPDATE accounts,orders" & _
" SET accounts.username = 'new_username',accounts.password = 'blabla'" & _
",orders.username='new_username'" & _
" WHERE accounts.username = 'old_username' AND orders.username='old_username'" & _
" OR accounts.username = 'old_username'"
Else
SQL = "UPDATE accounts" & _
" SET username = 'new_username',password = 'blabla'" & _
" WHERE username = 'old_username'"
End If
I tried to merge two SQLStrings but it updates all rows in one column(usernames) on the second table(orders)
SQL = "UPDATE accounts,orders" & _
" SET accounts.username = ''new_username",accounts.password = 'blabla'" & _
",orders.username='new_username'" & _
" WHERE (accounts.username = 'old_username' AND orders.username='old_username')" & _
" OR accounts.username = 'old_username'"