sql - how to get all rows and store it into single row based on dublicate column in mysql -


i have table below:

id  name   email 1        email1@gmail.com 2    b     email1@gmail.com 3    c     email1@gmail.com 4    d     email2@gmail.com 5    e     email3@gmail.com 6    f     email3@gmail.com 

expected output(while searching email)

id    name1  name2   name3  email  1          b       c      email1@gmail.com 

how result using mysql query?

using while loop can display want

while($dbrow = mysql_fetch_row($dbx)) {     print("<tr>");     $col_num = 0;      foreach($dbrow $key=>$value){         if($dbrow[$col_num] > 0)         {               print("<td>$dbrow[$col_num]</td>");         }         else          {             print("<td> </td>");         }      $col_num++;      }   print("</tr>"); 

}


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -