View Single Post
 
Old June 13th, 2007, 06:51 AM
jwhite68 jwhite68 is offline
Registered User
 
Join Date: Jun 2007
Location: Varna, , Bulgaria.
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I had thought the following code would do the job:

SELECT price,currency,CAST((price*rates.rate) AS UNSIGNED) AS priceval
FROM products, rates
WHERE currency=rates.from_code AND
rates.to_code=0
ORDER BY priceval ASC

Where to_code of 0 means EUROS. And matching currency field (in products) to rates.from_code, would match numeric value that represents each currency:

EUR = 0
USD = 1
GBP = 2

But when I execure this code, it just returns 0 for each of the 3 fields. Anyone got any ideas?