Hello listers, In mysql, is it possible imbed a conditional CASE statement within a SUM() function to effect how the SUM() returns the final value for a set of rows?
For example, if I have a table "foo" with column "score", and "score" has the rows with the values 1 to 10, can I write the SUM() in such a way to double the value of the number 7 for example to the final sum? Ie when the SUM() function encounters the number 7, add (score*2) instead of just score to the final total. Something like: SUM(CASE WHEN score = 7 THEN score*2 ELSE score END) AS final_sum (Of course this doesn't seem to work, but it's the best I can approximate) Any help, much much appreciated. Best, Peter D Bethke --------------------------------------------------------------------- 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