title: Go GORM Preload & Select only items matching on preload table condition
body: <p>Im trying to use GORM to select only items from the parent table that have a matching condition in a related table.</p>
  
  <pre><code>type Table1 struct {
      gorm.Model
      Name string
      Email string
      Items Table2
  }
  
  type Table2 struct {
      gorm.Model
      Product string
      otherfield string
  }
  </code></pre>
  
  <p>I want to return all Table1 items that have Product in Table2 set to a specific value. So far I am getting mssql: The multi-part identifier "visits.sign_out_time" could not be bound. a lot.</p>
  
  <p>My command is </p>
  
  <pre><code>var items []Table2
  db.Debug().Preload("Table2").Where("table2.product = ?", "xxx").Find(&amp;items).GetErrors()
  </code></pre>
  
  <p>Not entirely sure where I'm going wrong but for whatever reason the .Where() cannot access the second, preloaded table. How do I go about using GORM to achieve what I am trying to do?</p>
  
  <p>Thanks,
  Alex</p>