This is a subset of my table:
first | last | city
Fred | NULL | LA
Mary | Jane | Boulder
How do I concatenate every column without specifying the column names? (I have 20 columns in my REAL table but I don’t want to have to type them in). I have:
SELECT CONCAT('first', ',' , 'last' , ',' , 'city') FROM table; # How do I do it without specifying the column names????
desired result:
Fred,NULL,LA
Mary,Jane,Boulder
Short answer: you cannot.
Long answer: you can with
INFORMATION_SCHEMAand dynamic sql, but that is a really bad idea.