Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: GROUP BY....but not on all columns
On Jun 17, 1:41 am, "Michel Cadot" <micadot{at}altern{dot}org> wrote:
> <pankaj_wolfhun..._at_yahoo.co.in> a écrit dans le message de news: 1182022067.132225.271..._at_n15g2000prd.googlegroups.com...
> | Greetings,
> | I need to apply a group by in my query but not necessarily on all
> | columns in select list.
> |
> | For eg:
> |
> | select col1, col2, col3, col4, col5
> | from table_name
> | group by col1, col2, col3, col4
> |
> | Now the requirement is to include all 5 columns but group by only
> | first 4
> |
> | How can I achieve this? Any help would be appreciated.
> |
> | TIA
> |
>
> Instead of posting a wrong query
> post your needs in functional terms.
> What do you want?
>
> Regards
> Michel Cadot
Thanks for the reply Michael and sorry for that query as a demo
Here is the requirement.
We have one de-normalized table in one schema(say db2). The records from this table needs to be populated to a set of normalized table in another schema(say oracle). The records are inserted into final tables using a set of group by clause.
Means first table, in oracle schema, needs to be populated using source table, in db2 schema, using say group by col1, col2. Then the second table should be populated using group by col1, col2, col3. and so on
So in short, the requirement is: populating a set of destination tables using a single source table based on certain grouping columns
What is the way to do this?
TIA Received on Sat Jun 16 2007 - 16:07:23 CDT