groupby在自定义列和时间与SQL的时间
我有以下数据集:
collection_time | col_a | col_b |
---|---|---|
2022-06-27 14:15 | 20 | 15 |
2022-06-27 14:13 | -1 | : |
2022-06-26 20:15 | 21 | 47 |
我想具有以下输出
collection_time | count_negatives | count_positives |
---|---|---|
2022-06-27 | 1 | 1 |
2022-06-26 | 0 | 1 |
I was trying to use CASE WHEN expr THEN val ELSE val END
syntax, combined with GROUP BY collection_time, count_negatives, count_posivites
,但到目前为止我还没有运气。
我很难分享任何疑问,因为没有什么能给我任何有用的结果。 有人可以帮我一点吗?
I have a following dataset:
collection_time | col_a | col_b |
---|---|---|
2022-06-27 14:15 | 20 | 15 |
2022-06-27 14:13 | -1 | -1 |
2022-06-26 20:15 | 21 | 47 |
I would like to have the following output:
collection_time | count_negatives | count_positives |
---|---|---|
2022-06-27 | 1 | 1 |
2022-06-26 | 0 | 1 |
I was trying to use CASE WHEN expr THEN val ELSE val END
syntax, combined with GROUP BY collection_time, count_negatives, count_posivites
but I haven't had any luck so far.
It's difficult for me to even share any sort of queries as nothing gives me any sort of useful results.
Can anybody help me out a little bit with that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论