On 21-Jun-01 Craig Atkins wrote:
> Hello,
> _
> I am a little stumped on how to create the select statement that I need.
> _
> I have a_table of items, with a column called price, which contains a
> price in Spainish Pesetas.
> I have another table, with 1 record, that contains an 'exchange rate' to
> convert Pesetas to Pound Stirling. ( divide by approx 250)
> I want to select an item from my database and return the price in
> pounds, but I am getting stuck.
> _
> My select statement needs to:
> _
> Select an item from the 'items' table, select the price, divide the
> price by the number in the 'exchange' table.
> _
> Can someone possibly give me any ideas??
> (if I haven't confused you already!) ;-)

The classic conversion table (exchange):
e_from   e_to  factor
SPt      UKL    0.004 
UKL      SPt    250.0

select (p.price * e.factor)
from product as p, exchange as e
where p.id='phoo' and e.e_from='Spt' and e.e_to='UKL' ;

Regards,
-- 
Don Read                                       [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to