Is it possible to combine a select and insert statement into one statement? I would like to combine these two statements into a single database call.
Code:SELECT tx.account_balance as last_balance
FROM transactions AS tx
INNER JOIN (
SELECT MAX( txn_id ) AS last_tran
FROM transactions
WHERE user_id =63
) AS m ON tx.txn_id = m.last_tran
INSERT INTO transactions
(user, value)
VALUES
($user, last_balance+$amount )
