title: Sql , Get similar rows with product id into column in single row dynamically on column
body: <p>I am having tables like this:</p>
  
  <h1>products</h1>
  
  <pre><code>product_id, product_primary_image,product_name
  </code></pre>
  
  <h1>product_image</h1>
  
  <pre><code>image_id,product_id,image_url
  </code></pre>
  
  <h1>Desired result:</h1>
  
  <pre><code>product_id    product_primary_image    product_name  image_url1   image_url2   image_url3
  </code></pre>
  
  <p>This is what i have tried so far to get the result but  </p>
  
  <pre><code>  SELECT `product`.`product_id`,`product`.`product_name`,`product`.`product_primary_image`,`product_image`.`image_url` FROM `product_image` LEFT JOIN `product` ON `product`.`product_id` = `product_image`.`product_id`;
  </code></pre>
  
  <p>But its giving out put as</p>
  
  <pre><code>product_id   product_name   product_primary_image   image_url
  
  99           301R           Maroon1.jpg             Maroon3.jpg
  
  99           301R           Maroon1.jpg             Maroon2.jpg
  
  99           301R           Maroon1.jpg             Maroon.jpg
  </code></pre>
  
  <p>I want the result as </p>
  
  <pre><code>product_id  product_name    product_primary_image   image_url1      image_url2      image_url3
  
  99          301R            Maroon1.jpg             Maroon3.jpg     Maroon2.jpg     Maroon.jpg
  </code></pre>