Re: CASE statement within SUM()

2003-03-07 Thread dpgirago
/MDACC) Subject: Re: CASE statement within SUM() At 11:29 -0500 3/7/03, Peter D Bethke wrote: >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 exampl

Re: CASE statement within SUM()

2003-03-07 Thread Paul DuBois
At 11:29 -0500 3/7/03, Peter D Bethke wrote: 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

Re: CASE statement within SUM()

2003-03-07 Thread dpgirago
Peter, I think something like this will work: mysql> select sum( if(score=7, score * 2, score)) from table_name; David - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mys

CASE statement within SUM()

2003-03-07 Thread Peter D Bethke
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() i