← Home

Pratik Bhujel / Writing

The notebook.

A place for code I want to explain, mistakes worth remembering, and the occasional story from my life.

MySQL 2 min read

Filter grouped totals with HAVING

A report needs customers whose outstanding invoice total exceeds a threshold. WHERE filters individual rows before grouping; HAVING filters grouped results. Putting the aggregate c...