热线电话:13121318867

登录
2019-03-11 阅读量: 628
两条sql语句能不能组合成一条

问题描述:

select count(1) from student where age>20;

select count(1) from student where age<=20;

类似这两个查询,能不能合成一条查询?

解决方法:

select sum(age>20) age1, sum(age<=20) age2 from student;

0.0000
2
关注作者
收藏
评论(0)

发表评论

暂无数据
推荐帖子