【发布时间】:2016-12-15 13:51:28
【问题描述】:
我有类似的东西
id | name
---|-----
1 | Sarah
3 | Pat
4 | Lea
我正在寻找缺失的行。我尝试使用 generate_series 和左连接,但这是您在 Redshift 中无法执行的操作,因为不支持 generate_series。
没有临时表可以吗?
编辑
终于with a temporary table (0 to 1_000_000) 看到答案了。
【问题讨论】:
-
您需要临时表或子查询。因为你需要一些东西来告诉你什么是全套,知道缺少什么。所以答案是NO。
-
你怎么知道哪一行是“缺失”的?
-
@a_horse_with_no_name 系列中的 ID 缺失。
-
你为什么在乎?生成的 ID 不应该是无间隙的(尤其是如果它们是由序列生成的)。
标签: sql amazon-web-services amazon-redshift