Skip to content
Advertisement

Select customers who purchased BOTH this year and last

I’m fairly new to SQL and I’m using BigQuery to find customers who purchased in 2019 and 2018.

This is the query I’m using to find the customers who purchased in 2019.

I’m struggling now with how to pull in distinct users who purchased this year AND last year. Can anyone point me in the correct direction? Thank you.

Advertisement

Answer

Hmmm. I think I might do this as an aggregation query:

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement