sales * price AS `Turnover $` From titles;
HTH, Cor
- Original Message - From: "Karl Larsen" <[EMAIL PROTECTED]>
To: "Chris W" <[EMAIL PROTECTED]>
Cc: "MYSQL General List"
Sent: Thursday, June 22, 2006 10:04 PM
Subject: Re: Math problem
Chris
W" <[EMAIL PROTECTED]>
Cc: "MYSQL General List"
Sent: Thursday, June 22, 2006 10:04 PM
Subject: Re: Math problem
Chris W wrote:
Karl Larsen wrote:
I'm trying to multiply numbers one of which is money. The money looks
like this:
SELECT price FROM titles;
| pr
>It appears that mysys 4.1 does not know how to multiply a dollar
>amount to another number. Has anyone else seen this problem?
If price is a string beginning with '$', MySQL will autoconvert
SubString(price,2) to a numeric iif it's in a numeric expression, but
you'd be much better off losing t
Chris W wrote:
Karl Larsen wrote:
I'm trying to multiply numbers one of which is money. The money
looks like this:
SELECT price FROM titles;
| price |
++
| $20.00 |
| $19.99 |
| $7.99 |
| $19.99 |
| $11.95 |
| $19.99 |
| $14.99 |
| $11.95 |
| $22.95 |
| $2.99 |
| $10.95 |
| $7.
dollar/currency/money, call it whatever you like, but if it's got a $ in front of it, then it's a string, not a number. Your price
field should have been created as a decimal. I'm guessing it's a char type. You should also set your fields to default to 0, not
NULL.
The problem is with your setup,
[snip]
It appears that mysys 4.1 does not know how to multiply a dollar
amount to another number. Has anyone else seen this problem?
[/snip]
Your price column contains a dollar sign, making it a text field that
you cannot multiply with.
--
MySQL General Mailing List
For list archives: http:/
Karl Larsen wrote:
I'm trying to multiply numbers one of which is money. The money
looks like this:
SELECT price FROM titles;
| price |
++
| $20.00 |
| $19.99 |
| $7.99 |
| $19.99 |
| $11.95 |
| $19.99 |
| $14.99 |
| $11.95 |
| $22.95 |
| $2.99 |
| $10.95 |
| $7.00 |
| $2.99 |