Jump to content

Calculcation Based on MySQL Field - Newbie


chrison600

Recommended Posts

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?

 

Thanks,

 

Chris

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.