SQL SUM Pokaż 0 wyników
# if WHERE... finds no rows, then sum(grade) == null, so returns an empty table
# Using COALESCE, if null, then values = 0, returns 1 row with value == 0
SELECT COALESCE(SUM(grade), 0) as sum FROM grades
WHERE project_title = 'Recipe Storage';
Muddy Macaque