title: Query error with ambiguous column name in SQL
body: <p>I get an ambiguous column name error with this query (InvoiceID). I can't figure out why. They all seem to be joined correctly so why doesn't SSMS know to display VendorID?</p>
  <p>Query:</p>
  <pre><code>SELECT 
      VendorName, InvoiceID, InvoiceSequence, InvoiceLineItemAmount
  FROM Vendors 
  JOIN Invoices ON (Vendors.VendorID = Invoices.VendorID)
  JOIN InvoiceLineItems ON (Invoices.InvoiceID = InvoiceLineItems.InvoiceID)
  WHERE  
      Invoices.InvoiceID IN
          (SELECT InvoiceSequence 
           FROM InvoiceLineItems
           WHERE InvoiceSequence &gt; 1)
  ORDER BY 
      VendorName, InvoiceID, InvoiceSequence, InvoiceLineItemAmount
  </code></pre>