MFR
MFR

Reputation: 2077

write Legacy views in Standard SQL format

I wish to update my big query table :

FROM [myProject.Mydataset.ga_sessions_20171129]

I can update it to a standard SQL format:

 FROM `myProject.Mydataset.ga_sessions_20171129`

ga_sessions_20171129 is my table id and the last part of its name shows the last date that the table is updated, so the next table for the next day will be 20171130

How do I write something like that?

from `ga_sessions_*` where _TABLE_SUFFIX=TODAY

That updates the date every day to today's date

Upvotes: 0

Views: 385

Answers (1)

Mikhail Berlyant
Mikhail Berlyant

Reputation: 173190

Below is for BigQuery Standard SQL

FROM `project.dataset.ga_sessions_*` 
WHERE _TABLE_SUFFIX = FORMAT_DATE('%Y%m%d', CURRENT_DATE())

Upvotes: 1

Related Questions