Search code examples
mysqlsqlsqlyog

I want to put 'given' and 'surname' column together into 'fullname' in SQL, how would i go about in doing so. tnx


I currently have them separated but would prefer to have both together in one column.


Solution

  • SELECT CONCAT(given, ' ', surname) AS fullname FROM tablename
    

    or for null safe,

    SELECT CONCAT_WS(' ', given, surname)  AS fullname FROM tablename