0

Hi I have a column name called "condition", and I don't know if this is an SQL statement but its in color pink in my phpmyadmin sql. so how do you insert to a column that shares the same name to an SQL statement. I could just change it to another variable but this idea have me intrigued. I tried this:

How to deal with SQL column names that look like SQL keywords?

but it only works for select statements.

So does anyone have an idea how to do this using Insert, Update, and Delete?

Thank you

Community
  • 1
  • 1
magicianiam
  • 1,474
  • 7
  • 33
  • 70

2 Answers2

5

These words are called reserved words and in MySQL you will need to escape them using backticks:

insert into yourtable (`condition`)
select yourValue
from yourOtherTable;

My suggestion would be to stay away from using these words for tables and columns.

Taryn
  • 242,637
  • 56
  • 362
  • 405
1

In mySQL you can use

`condition` 

instead of

[condition] 

of mssql

Domus71
  • 151
  • 1
  • 5