title: How to Query if doesn't know which table has the data?
body: <p>I have following tables:</p>
  
  <p><code>TableA</code>: <code>Date</code>, <code>OrderNum</code>, <code>RejectionType</code></p>
  
  <p><code>TableB</code>: <code>OrderNum</code>, <code>MaterialNum</code>, <code>Size</code></p>
  
  <p><code>TableC</code>: <code>MaterialNum</code>, <code>Cost</code></p>
  
  <p><code>TableB2</code>: <code>OrderNo</code>, <code>MaterialNo</code>, <code>Size</code></p>
  
  <p><code>TableC2</code>: <code>MaterialNum</code>, <code>Cost</code></p>
  
  <p><code>TableA</code> will always have multiple rows for a <code>Date</code>, and in those multiple rows of <code>OrderNum</code>, some of <code>OrderNum</code> exists in <code>TableB</code>, and some exists in <code>TableB2</code>, we don't know. Every row in <code>TableB</code> or <code>TableB2</code> has a according <code>MaterialNum</code>, we don't know it is in <code>TableC</code> or <code>TableC2</code>. </p>
  
  <p>And also, although OrderNum in TableB has same attribute as OrderNo TableB2, since the column namesare different, I can not use <code>(... Union ...) As b where b.OrderNum = a.OrderNum</code></p>
  
  <p>How to query so that I can get following columns</p>
  
  <p>Date, OrderNum, RejectionType, MaterialNum, Size, Cost </p>
  
  <pre><code>where TableA.Date = @Date
  </code></pre>
  
  <p>Thanks！</p>