Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

sql sum show 0 result

# 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';
 
PREVIOUS NEXT
Tagged: #sql #sum #show #result
ADD COMMENT
Topic
Name
7+3 =