例えばこう
SQL
1create table install(id int primary key,timestamp timestamp);
2insert into install values
3(20008,'2019/10/19 10:45'),
4(20009,'2019/10/19 00:00');
5
6create table login(id int primary key auto_increment,uid int,timestamp timestamp);
7insert into login(uid,timestamp) values
8(20008,'2019/10/20 9:10'),
9(20008,'2019/10/20 11:20'),
10(20008,'2019/10/20 12:10'),
11(20008,'2019/10/20 14:20'),
12(20009,'2019/10/20 00:00'),
13(20009,'2019/11/20 00:00'),
14(20009,'2019/11/20 01:00'),
15(20009,'2019/11/20 02:00');
上記id=20008は4回あるが、id=20009は1回しか無い
SQL
1select uid,sum((select timestamp from install where id=login.uid) between date(timestamp) - interval 2 day and date(timestamp)) as count
2from login
3group by uid;
条件:3回以上を抜き出すので
SQL
1select uid
2from login
3group by uid
4having sum((select timestamp from install where id=login.uid) between date(timestamp) - interval 2 day and date(timestamp))>=3