I want to take a one-string query response to populate a SELECT statement in another query. Some say it's impossible, but Redshift makes fools of us all.
Imagine I have a table day_of_week as follows:
Day of Week | Weekend
---------------------
Monday | No
Tuesday | No
Wednesday | No
Thursday | No
Friday | No
Saturday | Yes
Sunday | Yes
And another party_time like this:
Yes | No
--------------------------
All the time | None of the time
I want to allow someone to just tell me a day (eg, "Wednesday") and then use the resulting Weekend value to query of party_time.
eg
SELECT (SELECT Weekend FROM day_of_week WHERE "Day of Week" = 'Wednesday')
FROM party_time
Result: 'None of the time'
How?