So I made a table with columns "from" and "to".
While writing to the table is fine because I am inserting one value into each column (and not referencing the columns by name), but whenever I want to retrieve data (SELECT), I want to retrieve... s开发者_开发技巧ay, only the "from" column.
Except as you guessed, it interprets "from" as an SQL command instead of a column name. Surrounding it in quotes just makes "from" populate the result set. Weird.
Can I do anything short of renaming the column? (Which isn't too bad, since the table really has no real data right now).
Thanks!
What I have now: SELECT from,id FROM permissions
Backticks should work in this situation.
e.g.
SELECT `from` FROM myTable;
But ideally you'd rename it. Perhaps to make it more descriptive also, e.g. "rangeFrom" or "dateFrom", etc.
SELECT (`from`,`to`) FROM `permissions`
Update.
Whoops, seems like I'm too slow for this site.
精彩评论