Jump to content

As FROM


sylesia

Recommended Posts

Ok, running a program where I am trying to access my DB.  Problem is one of the column names is actually AS, so when I run my select line
[code]
SELECT $try FROM table WHERE userName ' $userName'
[/code]
and $try later ends up as AS, it becomes AS FROM, which is not valid.  Whats the proper way of doing this?  I cannot do '$try' as it gives me literal values and does not actually ever pull anything out of the DB.
Link to comment
Share on other sites

[quote author=AndyB link=topic=118026.msg481949#msg481949 date=1165720570]
AS is a [b]reserved[/b] word with MySQL - http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html

Don't use reserved words for table or field names.
[/quote]

Backticks are always an option if you have no way to change the column name.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.