Select multiple columns with single alias

user1873379 picture user1873379 · Dec 3, 2012 · Viewed 10.1k times · Source

What's the alternate to

select table_name.* as colAlias from table_name

I assume this used to work pre 5.5 MySQL.

Answer

Gutenberg picture Gutenberg · Dec 3, 2012
SELECT CONCAT(col1,', ',col2,', ',col3) AS cols
    FROM table_name ORDER BY cols;

or also

SELECT CONCAT(col1,' ',col2,' ',col3) AS cols
    FROM table_name ORDER BY cols;