"Mike Roberts" <[EMAIL PROTECTED]> wrote:
> Is there any way to make one field in a table calculate another field.
> I'm making a DB that calculates commissions. So in the money_made
> field would have the # of sales (sales field) times whatever the
commission
> would be.

If you're updating existing records use an UPDATE query.

UPDATE my_table
SET money_made = sales * 0.15;

Otherwise, if you're using a programming language like PHP or Perl to access
the DB, do something like this.

INSERT INTO my_table
VALUES (
$sales, $sales * $commission_rate );

--
Steve Werby
President, Befriend Internet Services LLC
http://www.befriend.com/


---------------------------------------------------------------------
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

Reply via email to