title: Query table which whose name changes everyday - Bigquery
body: <p>I have a table which is like - <code>'numberedlanding_20210606_storefront'</code></p>
  <p>this table is generated every day and changes in the time stamp. For example, nextday table name would be  <code>'numberedlanding_20210607_storefront'</code></p>
  <p>I am writing a query that uses this table as a base table and does further does aggregations such as -</p>
  <p>For example -</p>
  <pre><code>with df1 as (select * from 'numberedlanding_20210606_storefront' where col1&gt;0),
  
  df2 as (select *,col1/col2 as test from df1),
  
  select * from df1 a join df2 b on a.name=b.name 
  </code></pre>
  <p>Now since this table name changes everyday how do I make it dynamic in this query?</p>
  <p>I tried looking into Bigquery's wildcard but I think it applies on to variable at the end of the name, I want to change the name which is in the middle.</p>
  <p>Also, here is something which I tried but was not successful -</p>
  <pre><code>CREATE TEMP FUNCTION
    getTableName() AS ((CONCAT(&quot;numberedlanding_&quot;,FORMAT_DATE('%Y%m%d', DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)),&quot;_storefront&quot;)));
  
  SELECT
    getTableName()
  </code></pre>
  <p>This just gives me the table name I want to use. Any suggestions would be really helpful.</p>