On the Warby Parker project, I thought on first using the command WITH to create a table and then use that new table to calculate the funnels and everything.
However, I saw that given that we’re joining them on the user_id column (for tables “quiz”, “home_try_on” and “purchase”), the name that the new table is giving to the quiz.user_id, home_try_on.user_id and purchase.user_id are “user_id”, “user_id:1” and “user_id:2”.
Then, the problem is that when I try to use these names with the SELECT command, it doesn’t work. Also it doesn’t work using the original names (q.user_id, quiz.user_id, etc.)
Could you please help me telling me what’s wrong? Thanks in advance
Here’s the code that is not running.
WITH ‘Table1’ AS (
SELECT * FROM quiz q
LEFT JOIN home_try_on h
ON q.user_id = h.user_id
LEFT JOIN purchase p
ON h.user_id = p.user_id
)
SELECT p.user_id FROM Table1;