sql - retrieve the number of times that a customer have come to this store -
i use sql code retrieve number of times customer have come store
select count(time_stamp), user_id, seller_id user_log_format1_haminjoori time_stamp != 1111 group user_id, seller_id
but code calculate same times !
for example :
customer1 seller1 1011 customer1 seller1 1011 customer1 seller1 1201
in example, want show me 2 number of times customer1 have come store.
use count(distinct)
:
select count(distinct time_stamp), user_id, seller_id user_log_format1_haminjoori time_stamp <> 1111 group user_id, seller_id;
Comments
Post a Comment