sql - There is a way to use a calculated field in the where clause? -


there way use calculated field in clause ?

i want like

select a, b, a+b total (    select 7 a, 8 b dual    union    select 8 a, 8 b dual    union    select 0 a, 0 b dual ) total <> 0 ; 

but ora-00904: "total": invalid identifier.

so have use

select a, b, a+b total (    select 7 a, 8 b dual    union    select 8 a, 8 b dual    union    select 0 a, 0 b dual ) a+b <> 0 ; 

logically, select clause 1 of last parts of query evaluated, aliases , derived columns not available. (except order by, logically happens last.)

using derived table away around this:

select *  (select a, b, a+b total (             select 7 a, 8 b dual             union             select 8 a, 8 b dual             union             select 0 a, 0 b dual)      ) total <> 0  ;  

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -