Skip to content

Instantly share code, notes, and snippets.

@hectorperez
Created April 28, 2017 14:58
Show Gist options
  • Save hectorperez/8a933aeb4abffa5fae018d0f9935a0dd to your computer and use it in GitHub Desktop.
Save hectorperez/8a933aeb4abffa5fae018d0f9935a0dd to your computer and use it in GitHub Desktop.
mysql subquery
SELECT *
FROM some_table
WHERE relevant_field IN
(
SELECT * FROM
(
SELECT relevant_field
FROM some_table
GROUP BY relevant_field
) AS subquery
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment