Ideas:
The title split into two portions
1 to identify all day in a logged in user name
2 plus b-day time for the conditions to complete the final results of queries 1
Specific code
Assumptions:
Log table: login_log
User name: username
Login time field: time
A time to: time_a
B time is: time_b
Code 1
SELECT username from login_log where time = 'time_a' GROUP BY username;
2 final code
SELECT username FROM login_log WHERE username IN (SELECT username from login_log where time = 'time_a' GROUP BY username) AND time <> 'time_b' GROUP BY username;