CASE WHEN (CASE WHEN t1.oneCount IS NULL THEN 0 ELSE t1.oneCount END ) >= ( CASE WHEN t2.twoCount IS NULL THEN 0 ELSE t2.twoCount END ) THEN (CASE WHEN t1.oneCount IS NULL THEN 0 ELSE t1.oneCount END ) ELSE ( CASE WHEN t2.twoCount IS NULL THEN 0 ELSE t2.twoCount END ) END + (CASE WHEN t3.threeCount IS NULL THEN 0 ELSE t3.threeCount END ) AS problemCount 替换为hive sql
时间: 2024-03-21 08:41:18 浏览: 53
asp下用fso生成js文件的代码
请使用以下Hive SQL替换给定的SQL语句:
```
CASE WHEN COALESCE(t1.oneCount, 0) >= COALESCE(t2.twoCount, 0) THEN COALESCE(t1.oneCount, 0) ELSE COALESCE(t2.twoCount, 0) END + COALESCE(t3.threeCount, 0) AS problemCount
```
在Hive中,使用COALESCE函数来替代CASE WHEN语句中的NULL检查。COALESCE函数将返回参数列表中的第一个非NULL值。因此,如果一个值为NULL,它将被替换为0。
阅读全文