Select AS statement

I am trying to select a column as an alternative name ‘from’ - the problem is ‘from’ is a reserved keyword in MySQL so it’s giving me an error. This is how I’ve tried to do it (in a relation):


'select'=>"subject, sent_at, user_id AS from"

I have tried putting quotes and backticks around ‘from’ but it still throws up an error. If I change ‘from’ to ‘from2’ it works OK.

This one works for me:




select id as `from` from article



Maybe you have to use `` this kind of quotes.

But why would you go with all this trouble… if a word is reserved just skip it and use something other… it will save you many problems in the future…