Skip to content

Instantly share code, notes, and snippets.

@MostafaNorzade
Last active November 17, 2020 07:30
Show Gist options
  • Save MostafaNorzade/0bad1a78a36cab249a4c2b5de4824614 to your computer and use it in GitHub Desktop.
Save MostafaNorzade/0bad1a78a36cab249a4c2b5de4824614 to your computer and use it in GitHub Desktop.
get_user_mobile
SELECT users.mobile FROM users
WHERE users.mobile NOT IN (
SELECT users.mobile FROM subscriptions
INNER JOIN users ON subscriptions.user_id = users.id
WHERE subscriptions.type IN (1,2) AND
subscriptions.status = 2 AND
users.mobile IS NOT NULL
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment