I've just started to dabble with MySQL, creating a database as much for actual use, as for learning experience. Thus, if my question is a really basic one, for which there is a manual page, please just refer me to it. :)
So, I have this table, let's call it table1, in which I amongst other fields have the two fields amount and cur. Obviously I use `amount' to store a amount (a price, as it were), and `cur' to store in which currency the price is.
If I do a query similar to:
SELECT SUM(amount) FROM table1 GROUP BY cur;
I get the total sum for the different currencies, but, and here's my question, what if I want to multiply the different currencies with their respective exchange rate and get the going total price for the _total_ sum, not just `total per currency'?
Might this be achieved by some sort of sub-select?
The function of what I'd like to do would be something similar to:
SELECT (SUM(amount) FROM table1 WHERE cur = 'SEK'), (SUM(amount) FROM table1 WHERE cur = 'EUR') FROM table1;
But obviously that doesn't work.
Any tips would be appreciated!
h: Kristian
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]