I need to count records from a table but I must treat values with pId
55 and 61 as one only if the user_id
is the same.
id pId user_id
6126 55 127742
6128 55 127584
6132 58 128788
6134 55 54445
6136 55 127897
6139 61 127584
select id, pId, user_id, count(1),
from table
where date >= '2017-01-19 00:00:00' AND date < '2017-01-20 00:00:00'
group by user_id
;