title: Bigquery - Substitute field if other field is blank
body: <p>I've got this code here: </p>
  
  <pre><code>select DealID,ExternalReference,order_number, sales_rule
  from flostream.orders
  join mobileheads.surveys on flostream.orders.ExternalReference = mobileheads.surveys.order_number
  //where DealID is null
  </code></pre>
  
  <p>What I want to happen is IF DealID (in flostream.orders) is null, replace it with sales_rule (in mobileheads.surveys)</p>
  
  <p>Please let me know if this can be done with Bigquery or if you can think of some workaround?</p>
  
  <p>Thanks!</p>
  
  <p>Nik</p>