I have a table
accountdetails
with fields
customerid,balance,account id
Now Im trying to update this through my node app where when I transfer amount, in one record the value should be debited and in another it should be credited
var data = {customerid,transferamount,accountid};
con.query('update accountdetails set balance = balance-? WHERE customerid = ? ,
[data.transferamount,data.customerid]')
con.query('update accountdetails set balance = balance+? WHERE accountid = ?,
[data.transferamount,data.accountid]')
So currently I have two commands to do this how can we limit this to one command since both are basically updating single table.
Any idea