mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-25 05:55:19 +01:00
27 lines
393 B
MySQL
27 lines
393 B
MySQL
|
SELECT
|
||
|
user_id,
|
||
|
ip,
|
||
|
max(used_at) AS used_at
|
||
|
FROM (
|
||
|
SELECT
|
||
|
id AS user_id,
|
||
|
sign_up_ip AS ip,
|
||
|
created_at AS used_at
|
||
|
FROM users
|
||
|
WHERE sign_up_ip IS NOT NULL
|
||
|
UNION ALL
|
||
|
SELECT
|
||
|
user_id,
|
||
|
ip,
|
||
|
updated_at
|
||
|
FROM session_activations
|
||
|
UNION ALL
|
||
|
SELECT
|
||
|
user_id,
|
||
|
ip,
|
||
|
created_at
|
||
|
FROM login_activities
|
||
|
WHERE success = 't'
|
||
|
) AS t0
|
||
|
GROUP BY user_id, ip
|