Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
sajanjacobk
Starting Member
7 Posts |
Posted - 2010-05-11 : 11:25:47
|
| I have a transaction table of which has the fields.transactionID, StudentID,transactionType, transactionDate, Amount.transactionId is the primary key.this table has about 23,000 rowsThere is also a table tblstudent in which all the students are listed with primary key StudentID.Now I need to add an additional field "balance" to this table.and the balance field needs to be populated against each row so that we get a sum(Amount) for each transactionID.I have tried to do something like pseudocodeUPDATE tbltransactionSET (balance= (SELECT SUM(balance) WHERE transactiondate< currentTransactionDate AND studentID= currentStudentID )WHERE transactionID is from 1 to 23000.I am using MySQLPlease help me with the SQL. Thank you very much in advance. |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2010-05-11 : 12:24:03
|
| Hi.This is a Microsoft SQL SERVER forum. You may get a reply from some of the kind cross platform guys but you'd probably be better posting somewhere where there is a MYSQL forumMaybe: http://www.dbforums.com/Best of Luck.Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
 |
|
|
|
|
|