Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darrellsilver/e5dfe8b46da7eb99e20a6f1b3b3f26b5 to your computer and use it in GitHub Desktop.
Save darrellsilver/e5dfe8b46da7eb99e20a6f1b3b3f26b5 to your computer and use it in GitHub Desktop.
Current mentors w/o active agreements
SELECT c.id, c.email, c.first_name, c.last_name
FROM contacts c
WHERE c.contact_type = 'Current mentor'
AND NOT c.id IN (
SELECT DISTINCT mentor_id
FROM agreements a
WHERE last_session is null
)
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment