lizzibel Posted April 4, 2007 Share Posted April 4, 2007 Hey guys I'm fairly new to this whole database thing, and i've hit a bit of a rut, and wondered if any of you can help me. I have written the following transaction and now have to represent it in terms of read_item and write_item operations, (eg read_item(X1) etc) but have no idea how to do it because of the nested queries and the different tables that are involved. Can any of you give me a solution? Here's the Transaction script below. Thanks. Lizzie x SET AUTOCOMMIT=0; START TRANSACTION; SELECT AccountNo, Balance FROM Accounts WHERE AccountType="Current" AND AccountNo IN (SELECT AccountNo FROM AccountsXCustomers WHERE CustomerNo = (SELECT CustomerNo FROM Cards WHERE CardNo=123456)); UPDATE Accounts SET Balance=Balance-500 WHERE AccountNo IN (SELECT AccountNo FROM AccountsXCustomers WHERE CustomerNo = (SELECT CustomerNo FROM Cards WHERE CardNo=123456)); INSERT INTO Transactions VALUES (700, (NOW()), "debit", 456134, -500, (SELECT AccountNo FROM Accounts WHERE AccountType="Current" AND AccountNo IN(SELECT AccountNo FROM AccountsXCustomers WHERE CustomerNo = (SELECT CustomerNo FROM Cards WHERE CardNo=123456))), (SELECT CustomerNo FROM Cards WHERE CardNo=123456)); COMMIT; Link to comment https://forums.phpfreaks.com/topic/45593-help-with-transaction-processing/ Share on other sites More sharing options...
gluck Posted April 5, 2007 Share Posted April 5, 2007 What do you mean read item? Do you mean a selection of data from table? I don't think you might be able to log that. For updates and inserts you can maintain createdate updatedate / time and figure it out. Please explain what you need and I might be able to help. Link to comment https://forums.phpfreaks.com/topic/45593-help-with-transaction-processing/#findComment-222527 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.