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

Home -> Community -> Usenet -> c.d.o.server -> Re: by filtering with diferent

Re: by filtering with diferent

From: Vladimir M. Zakharychev <vladimir.zakharychev_at_gmail.com>
Date: 23 May 2007 09:11:13 -0700
Message-ID: <1179936673.000208.284030@m36g2000hse.googlegroups.com>


On May 23, 7:16 pm, valigula <valig..._at_gmail.com> wrote:
> Is it possible to filter duplicates codes by filtering with diferent
> dates???
>
> I have a table from where i load into my tables, that table has not
> got PK on cod1. When i try to load into my table1 found that there is
> a lot of duplicates.
>
> So i am trying to group then as:
>
> if date1 is not null then return date1 as data1
> elseif data2 is not null then return data2 as data2
> elseif data3 is not null then return data3 as data3
>
> select distinct cod1, max (data1)
> from table
> where date1 is not null
> group by grouping sets (cod1 , date1 )
>
> this query returns some blanks that i dont know how to manage.
>
> Anyone has any idea ??
>
> Thanks in advance ..
> A.

Just add the primary key and handle exceptions and be done with it. Constraints are The Good Thing(tm), I don't really understand why people try to avoid them.

Regards,

   Vladimir M. Zakharychev
   N-Networks, makers of Dynamic PSP(tm)    http://www.dynamicpsp.com Received on Wed May 23 2007 - 11:11:13 CDT

Original text of this message

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