title: How to fetch data of multiple users using gorm?
body: <p>Database: MySql
  I have a two structs as follows:</p>
  
  <pre><code>type Person struct {
      gorm.Model
      Name    string
      Address string
  }
  
  type Address struct {
      gorm.Model
      PersonID int
      Address  []Address
  }
  </code></pre>
  
  <p>I want to fetch data of multiple persons with there adresses.
  I tried it like:</p>
  
  <pre><code>var result []Person
  db.Table("persons").Select("persons.id,persons.created_at, persons.updated_at,persons.deleted_at,persons.name,addresses.address").Joins("inner join addresses on addresses.person_id = persons.id").Scan(&amp;result)
  </code></pre>
  
  <p>I got result:</p>
  
  <pre><code>[
    {
      ID: 13,
      CreatedAt: '2018-03-28T16:25:43+05:30',
      UpdatedAt: '2018-03-28T16:28:31+05:30',
      DeletedAt: null,
      Name: 'roshan',
      Address: null
    },
    {
      ID: 13,
      CreatedAt: '2018-03-28T16:25:43+05:30',
      UpdatedAt: '2018-03-28T16:28:31+05:30',
      DeletedAt: null,
      Name: 'roshan',
      Address: null
    },
    {
      ID: 14,
      CreatedAt: '2018-03-28T16:25:43+05:30',
      UpdatedAt: '0001-01-01T00:00:00Z',
      DeletedAt: null,
      Name: 'kunal2',
      Address: null
    }
  ];
  </code></pre>
  
  <p>expexted result is</p>
  
  <pre><code>[
    {
      ID: 13,
      CreatedAt: '2018-03-28T16:25:43+05:30',
      UpdatedAt: '2018-03-28T16:28:31+05:30',
      DeletedAt: null,
      Name: 'roshan',
      Address: ['pune', 'nagpur']
    },
    {
      ID: 14,
      CreatedAt: '2018-03-28T16:25:43+05:30',
      UpdatedAt: '0001-01-01T00:00:00Z',
      DeletedAt: null,
      Name: 'kunal2',
      Address: ['New York']
    }
  ];
  </code></pre>