Skip to content

Instantly share code, notes, and snippets.

@rossmartin
Last active December 11, 2015 19:39
Show Gist options
  • Save rossmartin/4650090 to your computer and use it in GitHub Desktop.
Save rossmartin/4650090 to your computer and use it in GitHub Desktop.
MySQL Combine Two Statements With LIMITs using UNION
(SELECT 'lab' AS table_name, id FROM table1
WHERE organizerClassId = '4013-5' LIMIT 1)
UNION
(SELECT 'rad' AS table_name, id FROM table2
WHERE organizerClassId = '4013-5' LIMIT 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment