Case: check out the user log table login_log all logged in a day and not logged in b-day with a statement

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;

 

Guess you like

Origin www.cnblogs.com/night-bright/p/11610019.html