OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
Re: Add 15% to column?

From: Michael Stassen (Michael.Stassenverizon.net)
Date: Mon Oct 03 2005 - 12:45:21 CDT


Subscriptions wrote:
> Er... do you mean this instead?
>
> UPDATE your_table
> SET decimal_field = decimal_field + (0.15 * decimal_field);

No, but they do the same thing:

     decimal_field + (0.15 * decimal_field)
  = (1 * decimal_field) + (0.15 * decimal_field)
  = (1 + 0.15) * decimal_field
  = 1.15 * decimal_field

> Would this work?

Yes.

> Jenifer
>
>
> ----- Original Message ----- From: "Michael Stassen"
> <Michael.Stassenverizon.net>
> To: "Subscriptions" <subscriptionssitecenters.com>
> Cc: <mysqllists.mysql.com>
> Sent: Monday, October 03, 2005 12:25 PM
> Subject: Re: Add 15% to column?
>
>
>> Subscriptions wrote:
>>
>>> I have a decimal field in my table... what would be the query to add 15%
>>> to that number in every row? I need to mark the column up by 15% and
>>> want to
>>> make sure I get the query right the first time. heh
>>>
>>> Jenifer
>>
>>
>> UPDATE your_table
>> SET decimal_field = 1.15 * decimal_field;
>>
>> Michael

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql