Postgres Question
John Vetterli
jvetterli-zC6tqtfhjqE at public.gmane.org
Wed Jun 29 16:21:23 UTC 2005
On Wed, 29 Jun 2005, Lance F. Squire wrote:
> Assuming the table has these fields:
>
> Value | Currency
> -----------------
> 10.00 | US
> 25.00 | CDN
> 30.00 | GBP
>
> and the conversion table had these fields:
>
> Currency | Conversion
> ----------------------
> US | 1
> CDN | .75
> GBP | .55
> What would be the sainest way to search for anything less than $x CDN?
I think something along the lines of:
select <columns> from prices a, currencies b
where a.currency = b.currency
and a.value * b.conversion < <max-value>;
...assuming the tables are called "prices" and "currencies"...
Also, "<max-value>" would have to be the amount in whatever currency you
assign a conversion value of 1.
Also, "a.value * b.conversion" might need to be changed to "a.value /
b.conversion" depending on how you define the conversion values that get
stored.
HTH
JV
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list