sql - 计算 teradata 中每行的条目数
解决方案
您可以使用case
表达式:
select customer,
(case when col1 is not null then 1 else 0 end +
case when col2 is not null then 1 else 0 end +
case when col3 is not null then 1 else 0 end +
case when col4 is not null then 1 else 0 end +
case when col5 is not null then 1 else 0 end
) as num_entries
from t;
推荐阅读
- javascript - 纯 JS:将数据属性列表存储在数组中,然后迭代
- javascript - 使用 @keyframes 鼠标悬停时的 SVG 反向动画不起作用
- javascript - 为什么在js文件中用json声明变量而不是读取json?
- php - 无法使用 php 和 oci 选择“TEXT”列?
- c# - StreamReader.ReadLine() 非常奇怪的行为
- python - 如何在 python 列表中查找特定字符串,如果找到打印位置,否则打印 0
- java - 在世界的边缘转身
- html - 如何强制图像以纵向显示?
- php - 致命错误:未捕获的错误:无法将 mysqli_result 类型的对象用作数据库的数组
- google-sheets - 基于另一张工作表中的规则的单元格中文本的总和