title: Big Query Loop through Start and End date
body: <p>I have a table with Start and end date with the Interval of 6 months. Below is one example:</p>
  <pre><code>Row   start_date  end_date
  1     2018-09-18   2019-03-18
  2     2019-03-18   2019-09-18
  3     2019-09-18  2020-03-18
  </code></pre>
  <p>I have a master table (which is very big), So I have loop through this start_date and end_date and insert the record selected into the different table. Below is the sample query.</p>
  <pre><code>     create table dataset.t1 (v1,v2,v3,create_dt);
      
      LOOP
      
          insert into dataset.t1 (v1,v2,v3,create_dt) select v1,v2,v3,create_dt 
      from dataset.t2 where create_dt &gt;= (select start_date from dataset.t1) 
      and create_date &lt; (select end_date from dataset.t1)
  
  END LOOP.
  </code></pre>
  <p>When I tried with Loop I am getting below error:</p>
  <pre><code>Query error: Scalar subquery produced more than one element at.
  </code></pre>
  <p>Could anyone please help me on how to implement this. My final goal is to improve performance by dividing the date into different ranges.</p>