Bachas
Bachas

Reputation: 243

SQL column name is same as Its function name

There is some Data in the MySQL Workbench. Column name is Left , Right in one table .

 Select PersonNumber,Left,Right,PhotoNumbr from Person.  

This query is showing is error. How can I fetch these records ,One thing cannot change column name in table.

Upvotes: 0

Views: 4928

Answers (1)

Tim Biegeleisen
Tim Biegeleisen

Reputation: 521073

Escape in square brackets the column names which are coincident with SQL Server functions:

SELECT PersonNumber, [Left], [Right], PhotoNumbr
FROM Person;

For future reference, do not name your columns using keyword or function names.

Upvotes: 2

Related Questions