We are creating a query to get data from GA4 (BigQ...
# ask-questions
b
We are creating a query to get data from GA4 (BigQuery) . We want to see the data in real-time on the day we start the test, but the default query in GrowthBook only refers to the daily table, so we cannot see the data in the intraday table. Has anyone already created a query that references both the events_ and events_intraday_ tables at the same time?
w
I haven't done this before, so I'm not confident that it is the right approach. But perhaps you could try out
(<query you have now>) UNION (<query you have now but replacing the FROM with the events_intra_day>)
b
Great, it worked! (I used
UNION all
) Thank you😄
w
Glad to hear it. Yes doing
UNION all
might be more efficient but could lead to duplicates in the general sense, but I believe the events in the intraday tables are not yet in any events table. But perhaps during switch over times there is a chance an event might appear in both? I haven't researched that myself yet, so just don't know.
b
Right. The intraday table should be deleted when the events_ table is created, but I have not investigated the exact timing. Perhaps there could be a timing when two tables exist for the same day. I will try to change it to use Distinct.
w
UNION
does do a distinct over the entire row.
b
I receive an error with just
UNION
w
ah ok.
Then doing ``SELECT DISTINCT * FROM (<Current query with the UNION ALL bit>)`` might get at the same thing.
b
Oh thanks!!
m
I know this thread is a bit old, but I am trying to do the same thing. But I don’t know how to edit the queries to do the union with the intraday table. Any help would be appreciated!
w
Hi Yesi. You can click on the three dots and click edit.
Then click the Customize SQL button.
m
Ahh got it, thank you!