Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT username, email, COUNT(b.userid) AS log_count , temp1.max_count
- FROM i_user a
- LEFT JOIN i_user_login_logs b
- ON a.userid = b.userid
- LEFT JOIN (
- SELECT COUNT(b.userid) AS max_count
- FROM i_user a
- LEFT JOIN i_user_login_logs b
- ON a.userid = b.userid
- WHERE username <> 'Admin'
- GROUP BY a.userid
- ORDER BY max_count DESC
- LIMIT 1
- ) AS temp1
- ON temp1.max_count > 1
- WHERE username <> 'Administrator'
- AND isactive = 1
- GROUP BY a.userid
- HAVING (log_count = temp1.max_count)
- ORDER BY log_count DESC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement