> ## Documentation Index
> Fetch the complete documentation index at: https://docs.queryful.app/llms.txt
> Use this file to discover all available pages before exploring further.

# HAVING

> Keep only the groups whose totals match, after grouping.

`HAVING` filters the groups by their totals. [WHERE](https://docs.queryful.app/queryfulql/syntax/where.md) looks at single rows before they're grouped; `HAVING` looks at each group's totals afterwards.

```sql theme={null}
FROM sales
  SHOW net_sales, orders
  GROUP BY product_vendor
  HAVING net_sales > 1000
```

This keeps the vendors with more than 1,000 in net sales. `HAVING` takes the same operators, `AND` and `OR` as `WHERE`:

```sql theme={null}
FROM sales
  SHOW net_sales, orders
  GROUP BY product_vendor
  HAVING net_sales > 1000 AND orders >= 20
```

The metrics in `HAVING` need to be in `SHOW`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.