Quick Tip: MySQL CONCAT

While working on a project, I needed a way to combine two MySQL columns without handling it later in PHP or .NET.

In this case, I wanted to join a first name and last name into a single full name value. For example, Jenn from firstname and Tesolin from lastname would be returned as Jenn Tesolin.

MySQL’s CONCAT function is a simple way to do that directly in the query.

SELECT
    CONCAT(firstname, ' ', lastname) As fullname
FROM authors

Check out the official MySQL manual reference for more examples and information.

Hope this helps someone else.