title: BigQuery: Group by table name
body: <p>My dataset (ds1) looks like the following:</p>
  
  <pre><code>2014_01_01_tableA
  2014_01_01_tableB
  
  2014_01_02_tableA
  2014_01_02_tableB
  </code></pre>
  
  <p>The query:</p>
  
  <pre><code>SELECT date, COUNT(1) AS counter 
  FROM [ds1.2014_01_01_tableA], [ds1.2014_01_01_tableB], [ds1.2014_01_02_tableA], [ds1.2014_01_02_tableB] 
  GROUP BY date;
  </code></pre>
  
  <p>Returns:</p>
  
  <pre><code>date, counter
  2014-01-01, 100
  2014-01-02, 200
  </code></pre>
  
  <p><strong>Is it somehow possible to group by the table name as well?</strong> Something like this maybe? ...</p>
  
  <pre><code>SELECT date, COUNT(1) AS counter, TABLE_NAME() AS table_name
  FROM [ds1.2014_01_01_tableA], [ds1.2014_01_01_tableB], [ds1.2014_01_02_tableA], [ds1.2014_01_02_tableB] 
  GROUP BY table_name, date;
  </code></pre>
  
  <p>Expected result:</p>
  
  <pre><code>date, counter, table_name
  2014-01-01, 50, 2014_01_01_tableA
  2014-01-01, 50, 2014_01_01_tableB
  2014-01-02, 100, 2014_01_02_tableA
  2014-01-02, 100, 2014_01_02_tableB
  </code></pre>
  
  <p><code>TABLE_NAME() AS table_name</code> does not exist, unfortunately.</p>