获得不满足以下任何条件的行

发布于 2025-02-03 06:12:38 字数 334 浏览 4 评论 0原文

我有一个具有ID和不同值的表。我想让我的输出某些东西,

id   value
----------
 1   t
 1   f
 2   t
 3   f
 4   f
 4   f

返回

id  value
---------
3   f
4   f

如果我们查看输出,我的条件在这里检查我的id是否将所有f作为值,然后 f,如果它具有全部t,则不要不要在输出中包括行。

如何实现这一目标?

I have a table with id and different values. I want to have my output something which would looks like this

id   value
----------
 1   t
 1   f
 2   t
 3   f
 4   f
 4   f

Expected output

id  value
---------
3   f
4   f

If we look at the output, my condition here to check if my id has all f as value then return f, if it has all t then don't, and if any one of the id has t also don't include row in output.

How to achieve this ?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

匿名。 2025-02-10 06:12:38

创建子查询并相应地排除值。我认为HiveQL支持子句的位置。

select id, value

from your_data_source

where id not in 
(select id from your_data_source where value='t' group by id)

group by id, value

create subquery and exclude the values accordingly. i think hiveql supports where clause subqueries.

select id, value

from your_data_source

where id not in 
(select id from your_data_source where value='t' group by id)

group by id, value
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文