Skip to content

Les users sans organization et connection cette année

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
SELECT
    user_login.id,
    email,
    user_login.created_at
FROM user
JOIN user_login ON user_login.user_id = user.id
WHERE
    user.id NOT IN (
        SELECT user_id
        FROM organization_user_pivot
    )
    AND email NOT LIKE '%@inactive'
    AND user.id NOT IN (
        SELECT user_id
        FROM user_login
        WHERE created_at > '2022-11-24'
    )
GROUP BY user.id

Keywords

user organization user_login organization_user_pivot inactive