SQL进阶---在聚合函数中使用 CASE 表达式

CAUSE 表达式可以处理 SQL 中复杂的条件逻辑。

The aggregate function can be used externally with CASE to check the number of items directly. Table 1 , grouping the number of students, the exam number using COUNT().
条件1 :NUMBER()=1 ,使用MAX(score)。
Condition 2 : COUNT()=2 , MAX(CASEWHENNumber of examinees = 2 THEN scoresEND).
Student number, final score column, GROUP BY number of students. The tested field must be a specific number, such as 2 .
This can filter out the difference between taking the test once and taking the test twice. MAX 对CASE 电影的电影的电影,可以可以可以可以电影。

Experts use SELECT on CASE to avoid having complexity. 处理数据选择紧密,效率高。

评价一下自己。

sql中的case when用法