create table payment( user_id int(11), account int(11) not null, zip int(11) not null, dt date not null ); insert into payment values (1,123,55555,'2009-12-12'), (1,123,66666,'2009-12-12'), (1,123,77777,'2009-12-13'), (2,456,77777,'2009-12-14'), (2,456,77777,'2009-12-14'), (2,789,77777,'2009-12-14'), (2,789,77777,'2009-12-14'); select foo.user_id, foo.cnt from (select user_id,count(account) as cnt, dt from payment group by account, dt) foo where foo.cnt > 1;
iryndin Aug 23 2018-11-11T00: 00Z
source share