Created
October 17, 2016 20:15
-
-
Save Mikuana/7f50d52eb5719beb9e702c41c5ec653b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
dept_id AS dept_id | |
, 1 AS hours_id | |
, hours1 AS hours | |
FROM | |
hours_table t | |
WHERE | |
hours1 IS NOT NULL | |
UNION ALL | |
SELECT | |
dept_id AS dept_id | |
, 2 AS hours_id | |
, hours2 AS hours | |
FROM | |
hours_table t | |
WHERE | |
hours2 IS NOT NULL | |
/* ... repeat a whole bunch */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment