Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Use of Column Alias in GROUP BY

Re: Use of Column Alias in GROUP BY

From: <prochak_at_my-dejanews.com>
Date: 1998/12/14
Message-ID: <753uhl$k65$1@nnrp1.dejanews.com>#1/1

In article <367491EF.7100_at_teleport.com>,   GHouck <hksys_at_teleport.com> wrote:
> In the following query, since it appears that you cannot
> use a column alias in either a GROUP BY or HAVING clause,
> is there avoidable/unavoidable overhead in referring to
> the Function SECTION(..) or COUNT(..) more than once?
>
> Are the results of the 'calls' cached to offset the
> multiple calls?
>
> SELECT
> SECTION(MAPNO) AS "SEC", COUNT(*) AS "KNT"
> FROM
> UTIL_POLES
> GROUP BY
> SECTION(MAPNO)
> HAVING
> COUNT(*) > 1
> ORDER BY
> KNT,SEC;
>
> Is there an alternative method?
>
> Thanks,
>
> Geoff Houck
> systems hk
> hksys_at_teleport.com
> http://www.teleport.com/~hksys
>

My understanding is that the parser uses the expression to match the GROUP BY columns and the SELECT columns before any aliases apply. That may not be the real way it works, but it is how it effectively works. So either the calls "are cached" or the calls in the GROUP BY are really never made. The results are the same.

So the column alias would only save you a little typing time. There is no need to find alternate methods since there isn't any overhead to avoid.

--
Ed Prochak
Magic Interface, Ltd.
440-498-3702

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    
Received on Mon Dec 14 1998 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US