Announcing our $3.4M seed round from Gradient Ventures, FundersClub, and Y Combinator 🚀 Read more →
How to Write a Common Table Expression in BigQuery
Common table expressions (CTEs) help you break up complex queries in BigQuery. Here's a simple query to illustrate how to write a CTE:
with beta_users as ( select * from users where beta is true ) select events.* from events inner join beta_users on beta_users.id = events.user_id;
You can see a real example of using CTEs to generate a time series to avoid gaps in data.
Spread the wordTweet