Haim Evgi
Haim Evgi

Reputation: 125524

mysql select column from view problem

i create a view table like :

CREATE VIEW ViewManager AS
SELECT 
us.UserId AS 'Account Manager', .........

after that, when i run a query to select data from this view

like :

SELECT  'Account Manager' , .. from ViewManager

then the data i get in this column is the text 'Account Manager' and not the value of the this columns.

Is there a way to solve this ? Of course I can change the field name , but i want to know if there is another solution,

thanks.

Upvotes: 0

Views: 1280

Answers (1)

Vladislav Rastrusny
Vladislav Rastrusny

Reputation: 29985

You need to use backticks to escape column and table names.

SELECT `Account Manager` , .. from `ViewManager`

Upvotes: 1

Related Questions