mysql sum code example
Example 1: mysql sum with if
SELECT SUM(IF( `column` = 1, `column`, 0)) as total
Example 2: sum mysql column
SELECT sum( mark ) FROM `student`
SELECT SUM(IF( `column` = 1, `column`, 0)) as total
SELECT sum( mark ) FROM `student`