Skip to content

Instantly share code, notes, and snippets.

@ismaGNU
Created May 13, 2013 08:55
Show Gist options
  • Save ismaGNU/5567033 to your computer and use it in GitHub Desktop.
Save ismaGNU/5567033 to your computer and use it in GitHub Desktop.
SELECT and check if exist column in another table
SELECT
*, CASE WHEN EXISTS (
SELECT * FROM campaigns c
WHERE c.ev_id = e.ev_id) THEN 1 ELSE 0 END AS promoted
FROM
eventos e
WHERE
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment