Skip to content

Instantly share code, notes, and snippets.

@enriquemanuel
Created August 19, 2014 23:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save enriquemanuel/7cf9443d5df8abdb6651 to your computer and use it in GitHub Desktop.
Save enriquemanuel/7cf9443d5df8abdb6651 to your computer and use it in GitHub Desktop.
SQL - BB - Finding Users that have not logged in to the System and are not enrolled in any course
SELECT u.user_id, u.last_login_date
FROM users u WHERE NOT EXISTS (SELECT pk1 FROM course_users WHERE users_pk1=u.pk1 )
and u.last_login_date is null
-- and u.system_role = 'N' -- if we want to limit by the system role
order by user_id asc;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment