title: MySQL duplicates data in SELECT from multiple tables
body: <p>I have 6 tables, according to following structure
  <img src="https://i.stack.imgur.com/es4Lv.png" alt="erd">
  the query i am using </p>
  
  <pre><code>SELECT 
      campaigns.idCampaign,
  
      users.idUser AS idUser,
      users.identification AS userIdentification,
      users.name AS userName,
      campaign_users.commission AS userCommission,
      campaign_files.idFile AS idFile,
      campaign_files.name AS fileName,
      clients.identification AS clientIdentification,
      suppliers.identification AS supplierIdentification
  FROM
      campaigns
      LEFT JOIN campaign_users ON( campaigns.idCampaign = campaign_users.idCampaign)
      LEFT JOIN users ON( users.idUser = campaign_users.idUser )
      LEFT JOIN clients USING( idClient )
      LEFT JOIN suppliers ON ( suppliers.idSupplier = campaigns.idSupplier )
      LEFT JOIN campaign_files ON( campaigns.idCampaign = campaign_files.idCampaign)
  </code></pre>
  
  <p>This results in duplicate campaigns, according to the number of files in <code>campaign_files</code> or users in <code>campaign_users</code> (which is greater). </p>
  
  <p><img src="https://i.stack.imgur.com/zIOmC.png" alt="the result of the query">
  this is the result, as you can see the <code>idCampaign</code> is same but multiple times, i want to this in single object, like this</p>
  
  <pre><code>{
  
      idCampaign: 4,
      users: [
          {
              idUser: 1,
              userName: 'ADMIN' 
          },
          {
              idUser: 2,
              userName: 'Serena Huel'
          }
      ],
      files: [
          {
              idFile: 23,
              fileName: 'dshds9agds86das8gads8g5dsa.hal'
          },
          {
              idFile: 49,
              fileName: 'dshds9agds86das8gads8g5dsa.hal'
          }
          {
              idFile: 84,
              fileName: 'dshds9agds86das8gads8g5dsa.hal'
          },
          {
              idFile: 99,
              fileName: 'dshds9agds86das8gads8g5dsa.hal'
          }
      ],
      clientIdentification: "dolore",
      ...
  }
  </code></pre>
  
  <p>I have added the output as example but it can be PHP object, array etc.</p>