Home Tutorial Php Sql MySQL Append Column

 
 

Share on Google+Share on Google+
MySQL Append Column
Posted on: December 9, 2010 at 12:00 AM
Advertisement
This example illustrates how to append two column value of a table.

MySQL Append Column

This example illustrates how to append two column value of a table.

In this example create a select query to append the data of four column.

Table

+-----------+-----------+----------+----------------------------------+
| studentid | sectionid | courseid | time                             |
+-----------+-----------+----------+----------------------------------+
| 3         | 3         | 3        | Mon 14:30-16:00                  |
| 2         | 2         | 5        | Mon 11:30-12:00, Thu 09:00-11:00 |
| 1         | 1         | 6        | Mon 09:30-11:00                  |
+-----------+-----------+----------+----------------------------------+

Query

select studentid, CONCAT(studentid, sectionid, courseid, time) FROM mca;
Output
+-----------+----------------------------------------------+
| studentid | CONCAT(studentid, sectionid, courseid, time) |
+-----------+----------------------------------------------+
| 3         | 333Mon 14:30-16:00                           |
| 2         | 225Mon 11:30-12:00, Thu 09:00-11:00          |
| 1         | 116Mon 09:30-11:00                           |
+-----------+----------------------------------------------+
Advertisement

Related Tags for MySQL Append Column:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: December 9, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com