How to use the CONCAT MySql function to concatenate 2 table columns

H

How Can We Help?

The CONCAT function can be used to concatenate two strings to form a single string or two columns to form a single column.

Say for Example you have a table users with columns name and surname and you would like to display both as one name you would use the CONCAT function to join the two fields as in the Example below

SELECT CONCAT(name," ",surname) AS fullname FROM users;

The above code will display something similar to Joe Soap should Joe be stored in the name column and Soap be stored in the surname column.

About the author

Ian Carnaghan

I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment.

About Author

Ian Carnaghan

I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment.

Follow Me