Jump to content


Calculcation Based on MySQL Field - Newbie

  • Please log in to reply
No replies to this topic

#1 chrison600

  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 05 June 2003 - 05:12 PM

Hi all,

I would like to perform a simple multiplication operation against a field stored in a MySQL database. I need the results returned to a particular field in a table other than that which contains the multiplied field... That\'s as clear as mud...

A function that represents what I would like to do would be something like:

.02x = y

Where x is a PRICE field and y is a FEE field.

In other words, I want to charge a FEE that is 2% of the PRICE.

The PRICE is stored in the \'PRICE\' field of the \'g_class\' table.

The FEE is stored in the \'CHARGE\' field of the \'g_c_price_inc\' table.

The \'CHARGE\' field is a DOUBLE (16,2) type.

I can manipulate the \'CHARGE\' field directly, but I would like to stay away from changing the field type. I\'m not sure #1) if I can enter a formula into the \'CHARGE\' field without changing the field attributes, and #2) what the heck the formula should look like.

Can anyone help?



0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users