MySQL guarantees that individual statements are atomic, so you can use something like this:
UPDATE mytable SET balance = balance + 100 Of course, you'd have to provide the right WHERE clause... Dean Harding. > -----Original Message----- > From: Bryan Waters [mailto:[EMAIL PROTECTED] > Sent: Sunday, 23 February 2003 11:40 am > To: '[EMAIL PROTECTED] Mysql. Com' > Subject: Cumulative Balance Field > > I want to keep a cumulative balance field in a mysql table. How do I do > this without corruption... > > if the table looks like this: > > datetime,desc,amount,balance > > How can I insert a new record setting the balance field to the last > balance > value + amount and not have data corruption if multiple inserts are > happening on different connections? > > > --------------------------------------------------------------------- > Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > > To request this thread, e-mail <[EMAIL PROTECTED]> > To unsubscribe, e-mail <mysql-unsubscribe- > [EMAIL PROTECTED]> > Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php