mysql 列序号,在mysql中使用列号而不是名称进行选择
Is there any way to do something like :
SELECT * FROM TABLE WHERE COLUMN_NUMBER = 1;
?
解決方案
If your table has a column named COLUMN_NUMBER and you want to retrieve rows from the table where that column contains a value of '1', that query should do the trick.
I suspect that what you are trying to do is reference an expression in the select list with an alias. And that is not supported. An expression in the WHERE clause that references a column must reference the column by name.
We can play some tricks with inline views, to give an alias to an expression, but this is not efficient in terms of WHERE predicates, because of the way MySQL materializes a derived table. And, in that case, its a name given to the column in the inline view that has to be referenced in the outer query.
總結(jié)
以上是生活随笔為你收集整理的mysql 列序号,在mysql中使用列号而不是名称进行选择的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: mysql 对库中表授权_对mysql数
- 下一篇: linux cmake编译源码,linu