0

From the answer of question MySQL pivot table query with dynamic columns

I modified(added new values) the query(demo 1) in the fieldname with special characters like -, (, ). here's updated query demo 2 and got the syntax error

How do I write the correct syntax of concat with special characters from the demo 2?

spajce
  • 7,044
  • 5
  • 29
  • 44
  • Although my advice would be: do not do this. – Shadow Apr 03 '21 at 07:16
  • I think this is not duplicate, my goal is to generating dynamic columns and trying to override the special characters from the generated pivot columns names. NOT adding new column names with special character in the table to database. – spajce Apr 03 '21 at 14:48
  • Column names are column names - it does not matter if you are creating them dynamically as aliases in a select query or you add them to a table. Same rules apply. You really should try the solution suggested to the duplicate question. – Shadow Apr 03 '21 at 15:06
  • ok I already tried the backticks ``` in the `fieldname` but no success .please kindly [check](https://dbfiddle.uk/?rdbms=mysql_5.6&fiddle=b61fba4aed2f1892c4dd5cb1f4c24345) – spajce Apr 03 '21 at 15:26

0 Answers0