Having trouble with Welp Project

Hello, am having a hard time with the following question : Sometimes on Welp, there are some old reviews that aren’t useful anymore.

Write a query using the WITH clause to select all the reviews that happened in 2020. JOIN the places to your WITH query to see a log of all reviews from 2020.

Although i think i’ve managed to right down the query the right way i can’t find which ON statement to use.

Here’s my query :

What would be the key shared between these two tables? I’d imagine you’ve already used it in previous steps.

1 Like

Can’t find any key shared between them :frowning: . Since WITH creates a new temporary table . It’s a bonus question so i haven’t used is before. places table doesn’t have any column that says something about review date or something .

You use * in your select statement so your table would be almost (with the exception of the rows filtered out by WHERE …) identical to the original reviews table. Perhaps it would be worthwhile just querying this table (perhaps with LIMIT) so you know exactly what you did when creating the temporary table.

1 Like

I think * is necessary because we want the other information aswell. T

Tried something like this doesn’t seem to work either. :frowning:

One tip to work with this is to make sure your query returns the results you expect before you try to use it in a WITH

will not return any results, so there is nothing to join. Focus on getting results with the subquery first, then you should be good to go


Be careful with your comparisons in this is instance, double check what strftime actually returns.


Thanks for the feed back ! It seems ’ ’ were missing from 2020 . On to the next one ! :smiley:

1 Like

But why that sentence don’t even return nothing.
I have try to use the missing quotes in the 2020 and others comparisons whit strftime but I even still get nothing.
Can you explain a little bit more please.

The previous issue boils down to the fact that '2020' is not equal to 2020 due to the comparison between different data types. What have you tried?

You can trial the output of strftime if you wanted to test things, see for example the following (you could even throw in a WHERE clause to check the other side of the comparison should you wish to)-

select strftime("%Y", review_date)
from reviews;
1 Like

Interesting. As I went through the reviews one by one, I see a couple in the year 2020. Not sure why it would not return anything for 2020.

missing quotes in 2020 .
It should be

with reviews20 as (
select *
from reviews
where strftime("%Y", review_date) = ‘2020’
select *
from reviews20
join places
on reviews20.place_id = places.id;


Thanks for this contribution - i didn’t have this issue but just seeing other explain around a situation and also how to troubleshoot is really helpful :slight_smile:

1 Like