0

I have a database where some columns have HTML tags in them, IE

Rot<sub>1</sub>

I try running queries, like

SELECT Rot<sub>1</sub> FROM chem.thermTable;

But I get an error message in my SQL syntax. Putting the column name in quotes simply returns the column name. Typing

SELECT * FROM chem.thermTable;

Works but returns other values I don't need as well. I searched and haven't found any solutions. Thanks for your help!

Edit: I am trying to query

SELECT Method,Basis,Rot<sub>1</sub> from chem.thermtable;
1
  • Why the hell you want to put HTML tags in column name, at first place... This might bring you a lot of problems in future. Commented May 22, 2014 at 17:29

2 Answers 2

1

You must use back quotes around the column name like this :

SELECT `Rot<sub>1</sub>` FROM chem.thermTable;

IMHO, this a not a clean column name and you should consider renaming it.

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

1 Comment

Thanks! That seems to have done it. I will consider changing the column names too.
0

Are you asking for this?

SELECT ColumnNameX, ColumnNameY, ColumnNameZ FROM chem.thermTable;

Where you'd change the ColumnName X, Y, and Z to be the column names you want. If not, you should perhaps clarify your question with an example of a few rows worth of data.

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.