Two columns from one in Mysql?

Codes here !

Moderators: egami, macek, gesf

Post Reply
johnj
php-forum Super User
php-forum Super User
Posts: 1803
Joined: Thu Mar 10, 2011 5:07 pm

Tue Jul 09, 2013 7:27 pm

For this, when you write your sql select query, you need to order the rows by the column that you are focussing, in this case it will the column called 'Name'.

Try something like this:
Select * from your_table ORDER BY Name, Class;

johnj
php-forum Super User
php-forum Super User
Posts: 1803
Joined: Thu Mar 10, 2011 5:07 pm

Thu Jul 11, 2013 6:47 am

For that you will save all the necessary data to a temporary string and you will write the row ONLY when the field NAME changes. In that way, you will have class1 and class2 on the same row.

Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 3 guests