我使用此SQL代码来检索客户来到此商店的次数
select
count(time_stamp), user_id, seller_id
from
user_log_format1_haminjoori
where
time_stamp != 1111
group by
user_id, seller_id
但是此代码计算的次数相同!
例如:
customer1 seller1 1011
customer1 seller1 1011
customer1 seller1 1201
在这个例子中,我想给我看一下customer1来这家商店的次数。
答案 0 :(得分:1)
使用count(distinct)
:
select count(distinct time_stamp), user_id, seller_id
from user_log_format1_haminjoori
where time_stamp <> 1111
group by user_id, seller_id;