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

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -