数据湖探索 DLI-HAVING子句嵌套子查询:示例

时间:2024-07-01 21:07:18

示例

对表student_info按字段name进行分组,计算每组中记录数,若其记录数等于子查询中表course_info的记录数,返回表student_info中字段name等于表course_info字段name的记录数。

1
2
3
SELECT name FROM student_info
  GROUP BY name
  HAVING count(name) = (SELECT count(*) FROM course_info);
support.huaweicloud.com/sqlreference-dli/dli_08_0177.html