> For the complete documentation index, see [llms.txt](https://zpliu.gitbook.io/booknote/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zpliu.gitbook.io/booknote/mysql/chang-jian-han-shu/02-chang-jian-han-shu.md).

# 常见函数

## 1.`GROUP BY`分组查询

### 1.1分组前的筛选

where 语句放在group by 语句前

```sql
SELECT 
  AVG(id),
  orderid 
FROM
  `pmw_goodstype` 
GROUP BY orderid ;
```

### 1.2分组后的筛选

`HAVING`关键字
