Sikandar
Sikandar

Reputation: 160

Select * from Select

Its very weird situation I know, nut I have got myself into it somehow. I have to connect to some other system service by passing some parameters in url.

In their service they are creating some query using parameter I pass.

For my case I have to pass 'Select' as a parameter name which is actually some class name on their side. So they end up in creating query as Select * from select and some condition.

On execution I am getting error response as:

'There was a syntax error in a SQL query or filter expression at line 1, position 186. Saw \"Select\" but expected '..SQL: \"SELECT col1, col2 FROM Select AS D where some condition.

Can somebody help me on this.

Upvotes: 1

Views: 168

Answers (2)

rohan dhama
rohan dhama

Reputation: 56

Its recommended not to use MySQL reserved keywords.. but if its necessary there is a solution..

Use this, it will work for you :

select * from yourdatabasename.select

Upvotes: -1

Andrey Korneyev
Andrey Korneyev

Reputation: 26886

Since Select is reserved word, you have to escape it by enclosing in backticks characters in order for MySQL to process your query:

select * from `select`

Upvotes: 4

Related Questions