代码改变世界

一个sql语句中用多个where

2020-04-10 10:21  ZealouSnesS  阅读(3433)  评论(0编辑  收藏  举报

 

select SUM(case when total < 60 then 1 else 0 end) as 'studentMarks1',
       sum(case when total > 80 then 1 else 0 end) as 'studentMarks2' 
from School
where Id = '8'

参考:https://stackoverflow.com/questions/42481826/how-to-use-multiple-where-clause-in-one-sql-query