SUM(amount) adds non-NULL amounts inside each category group.
highlighted = computed this step
Input table
Use the same sales rows with one NULL amount.
Group query
Group by category and add the non-NULL amounts.
GROUP BY category, SUM(amount)
Grouped output
The NULL amount is skipped by SUM.
sums by category