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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

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

android - How to create dynamically Fragment pager adapter -