Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select multiple columns with single alias

What's the alternate to

select table_name.* as colAlias from table_name

I assume this used to work pre 5.5 MySQL.

like image 809
user1873379 Avatar asked Jul 29 '26 03:07

user1873379


1 Answers

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;
like image 158
Gutenberg Avatar answered Jul 31 '26 19:07

Gutenberg