Results 1 to 7 of 7
Thread: Combining an insert and select?
Dec 3, 2008, 17:54 #1
- Join Date
- Jan 2006
- 0 Post(s)
- 0 Thread(s)
Combining an insert and select?
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.
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 )