Query multiple currencies

Posted by TiuTalk on Stack Overflow See other posts from Stack Overflow or by TiuTalk
Published on 2010-04-30T09:56:08Z Indexed on 2010/04/30 9:57 UTC
Read the original article Hit count: 237

Filed under:
|
|
|
|

I need store multiple currencies on my database... Here's the problem:

Example Tables:

[ Products ]
id (INT, PK)
name (VARCHAR)
price (DECIMAL)
currency (INT, FK)

[ Currencies ]
id (INT, PK)
name (VARCHAR)
conversion (DECIMAL) # To U$

I'll store the product price with the currency selected by the user...

Later I need to search the products using a price interval like "Search products > with price from U$ 50 to U$ 100" and I need the system convert these values "on the fly" to run the SQL Query and filter the products.

And I really don't know how to make this query... :/

© Stack Overflow or respective owner

Related posts about sql

Related posts about mysql