gpt4 book ai didi

mysql - 查找 2 个不同日期具有一个值的列

转载 作者:行者123 更新时间:2023-11-30 00:31:22 25 4
gpt4 key购买 nike

我有下表:

表1

列如下:

date , time , user_id , channel

我希望找到在 2 个不同日期、 channel (比如 CNN、NBC...)观看的用户列表,所有相关条目。

表示 DATE 1 和 DATE 2 的 channel 相同,user_id 也相同。

我尝试了以下所有操作:

select distinct  monthname(date),max(date), min(date) count(distinct user_id)   
from iptv_clean
group by monthname(date)
having min(date)!= max(date)

但是好像效果不太好。

有什么想法吗?

最佳答案

以下列出了用户在多个日期观看的用户和 channel :

select user_id, channel, count(distinct date)   
from iptv_clean
group by user_id, channel
having count(distinct date) > 1;

这是你想要的吗?

关于mysql - 查找 2 个不同日期具有一个值的列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22491954/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com