count(case when md.PSN_TYPE = rh.PSN_TYPE and mfsld.GEND = rh.GEND and mfsld.AGE between 18 on 59 then md.MDTRT_ID end) '就诊人次' 指出我的语法错误
时间: 2024-05-07 17:21:28 浏览: 67
你的SQL语法错误在于:在 `between` 关键字后面缺少一个 `and` 来指定范围的上限。正确的语法应该是:
```
count(case when md.PSN_TYPE = rh.PSN_TYPE and mfsld.GEND = rh.GEND and mfsld.AGE between 18 and 59 then md.MDTRT_ID end) '就诊人次'
```
这样就可以统计符合条件的就诊人次了。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)