Just wondering, how this query will be handled by MySQL, will sum() calculated twice if sum(credits) != NULL or does MySQL has optimization in place for such queries.
select if(sum(credits)=NULL, 0, sum(credits)) from ......
Thanks
Copyright Notice:Content Author:「mesibo」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/37875463/mysql-if-condition-optimization