title: Gorm fill struct within a struct with the results not fully working
body: <p>I do a simple query in Gorm:</p>
  <pre><code>err := db.Preload(&quot;users&quot;).
      Where(&quot;orders.created_at &gt;= now() - interval 3 day&quot;).
      Find(&amp;orders).
      Error
  </code></pre>
  <p>I also tried it this way:</p>
  <pre><code>err := db.Select(&quot;orders.*, users.*&quot;).
      Where(&quot;orders.created_at &gt;= now() - interval 3 day and users.first_name != ''&quot;).
      Joins(&quot;left join users on users.customer_id = orders.customer_id&quot;).
      Find(&amp;orders).
      Error
  </code></pre>
  <p>This should fill a &quot;orders&quot; struct which has a &quot;Users Users&quot; struct in it. When I log my query it looks fine, when I copy and paste it into Phpmyadmin it works perfectly, but in Go my struct is empty! well... the &quot;users&quot; part is empty. The orders part is filled correctly. Does anyone know what I am doing wrong? my orders struct:</p>
  <pre><code>type Orders struct {
     CustomerId    int
     Users         Users   `gorm:&quot;foreignKey:customer_id&quot;`
     Method        string
     Amount        float64
     Subtotal      float64
     Total         float64
     Btw           float64
     Status        string
     OrderMailSend int
  }
  </code></pre>
  <p>and my users struct:</p>
  <pre><code>type Users struct {
     CustomerId int
     Email      string
     FirstName  string
     LastName   string
  }
  </code></pre>
  <p>If I use my first query and call it (in Go) I will receive this result:</p>
  <pre><code>{
      &quot;CustomerId&quot;: 211197,
      &quot;Users&quot;: {
          &quot;CustomerId&quot;: 0,
          &quot;Email&quot;: &quot;&quot;,
          &quot;FirstName&quot;: &quot;&quot;,
          &quot;LastName&quot;: &quot;&quot;
      },
      &quot;Method&quot;: &quot;iDEAL&quot;,
      &quot;Amount&quot;: 10,
      &quot;Subtotal&quot;: 10,
      &quot;Total&quot;: 10,
      &quot;Btw&quot;: 0,
      &quot;Status&quot;: &quot;paid&quot;,
      &quot;OrderMailSend&quot;: 0
  }
  </code></pre>
  <p>together with an error: can't preload field users for models.Orders</p>
  <p>If I would just copy and paste the query itself in phpmyadmin console and run it, I do get complete results i.e. one order with a user connected to it. So that means the query itself is alright I recon.</p>
  <p>In the database the orders table (customer_id) has a foreign key to the users table (customer_id).</p>