user893856
user893856

Reputation: 1029

With MySQL, how do I update a column which is a reserved key?

if I were doing it:

update p set te = concat('Ez itt a(z) ',xxxx,' tájtl');

it would work OK, but xxxx is "key" now, so:

update p set te= concat('Ez itt a(z) ',key,' tájtl');

so I cant do that. How to fix it? Renaming that column is not an option

Upvotes: 0

Views: 70

Answers (4)

Riz
Riz

Reputation: 10246

update p set te= concat('Ez itt a(z) ', `table_name`.`key`,' tájtl');

Upvotes: 1

James.Xu
James.Xu

Reputation: 8295

update p set te= concat('Ez itt a(z) ',`key`,' tájtl');

Upvotes: 2

Marco
Marco

Reputation: 57593

In MySQL, every reserved word must be eclosed in backticks:

UPDATE p SET te = CONCAT('Ez itt a(z) ', `key`, ' tájtl');

Upvotes: 3

Connell
Connell

Reputation: 14411

In MySQL, you have to put the column name in backticks ( ` symbols )

update p set te = concat('Ez itt a(z) ', `key`, ' tájtl');

Upvotes: 3

Related Questions