Translating with DrWatson… this can take a few seconds the first time.
This is a genuine, complex translation. DrWatson protects commands, error codes, and log output while naturally translating the surrounding text. It’s translated once and saved.
Hi,
What is the equivalent statement for sum(if(condition,result1,result2)) for
mysql RDBMS or CASE WHEN ... for sybase or DECODE for Oracle ?
I have a statement like SELECT sum(field)/sum(items) and I got an error when
sum(items)=0 (div/0 error) so I'd like to use if sum(items)=0 display 0 or
NULL otherwise calculate the expression.
TIA,
Nicky.
Your privacy choices
We use strictly necessary cookies to make this site work. With your
consent we’d also use optional cookies for analytics and marketing. You can accept all,
reject all, or choose. Read our Cookie Policy.