select count(*) from B where b.登录时间<= (select max(结束时间) from A) and b.登录时间>= (select min(开始时间) from A );
这样可能会有点慢