Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: Unions With Grouping Group Values
Terry Dykstra wrote:
> An easy solution is to add another select on top of your current one:
>
> select bldg,year, sum(labour), sum(parts),sum(other)
> from (
> your original select)
> group by bldg, year
>
Thanks Terry, that sounded like I should have slapped the side of my head and yelled some Homerism, but I'm doing something wrong.
I would have thought the select outside of my original as you suggested would use the column alias(es) defined in the original union select. But I keep getting errors telling me I have invalid column names. I've tried various combinations and changes, including removing the group values and groupings in the constituent selects but nothing seems to work, yet.
Is there anything special I must keep in mind when making a select over a select?
Thanks for your help so far, hopefully, I'm forgetting something simple.
-- Tim http://www.ucs.mun.ca/~tmarshal/ ^o< /#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake /^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - MeReceived on Fri Sep 16 2005 - 14:55:01 CDT