开发者

how to use alias field in query ? (oracle 10g)

If I write this query:

select Fname,Age*2 as Demo from Men where Demo = 5

then I get the error

开发者_如何转开发

ORA-00904 (Demo not identified )

How I can use it?


You don't need "as" in Oracle.

You simply write:

select fname, asge*2 demo from men;

However you cannot use the alias in the "where"-clause.

A Quote from a post on another site:

The technicality of it is that when the where clause and the group by clause are being executed, the select part of the query has not run and the alias has not been assigned. Since the order by is technically done after the select the aliases can be used.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜