4

for example we have a table with the columns "id", "name", "type", "year". My target output would be SELECT CONCAT(id, name, type, year) FROM table.

Is it possible to do this without knowing the columns, so I can use it with every table I want without analysing its columns first? Something like CONCAT(*)?

I hope you can help me.

Thank you very much.

Regards Wulf

1
  • 1
    It is not possible. The fileld names have to be known. But you can output data into the CSV file without field separator. Commented Oct 28, 2011 at 9:48

2 Answers 2

6

AFAIK, you first have to know the columns. This

SHOW COLUMNS FROM table

will return all columns. Use the result to make your SELECT query.

Sign up to request clarification or add additional context in comments.

1 Comment

Too bad that there is no * way, but thanks anyway! This is how I'm doing it already.
2

Check the information_schema table of MySQL, it contains meta-information concerning your tables. http://dev.mysql.com/doc/refman/5.0/en/information-schema.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.