Re: SUM same field twice in one SELECT?

2004-04-28 Thread Kristian Niemi
Thanks! Now I can get it to work just the way I want it. ... and learned how to use IF and CASE statements with MySQL at the same time! :) Oh, and it's actually precisely because FIM doesn't exist anymore that I want to convert it to euro. ;) (And SEK just comes along for the ride.) Harald Fuch

Re: SUM same field twice in one SELECT?

2004-04-27 Thread Kristian Niemi
ted sum? Wouldn't one sum be enough? After all you are already taking into consideration the currency change by the division factor. Yoed -Original Message----- From: Kristian Niemi [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 28, 2004 1:23 AM To: Yoed anis Subject: Re: SUM same field

RE: SUM same field twice in one SELECT?

2004-04-27 Thread Yoed anis
Use if statements: Your query would then look like this: SELECT SUM(IF(cur = 'SEK',amount,0)), SUM(IF(cur = 'EUR',amount,0)) FROM table1 WHERE ... The if statement has three properties, the first is the condition, the second what to do if true, the third, is what to do if false. Hope this helps,