Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Why are there DUPES!?!?
Marc Connolly wrote:
> I am getting dupes and for the life of me can not see why. My latest guess
> at a solution is to
> create a composite key in table pn_sc that includes "sc"? I am lost and
> this is just a stab in the
> dark. Any help really appreciated!
>
> here is the query :
>
> INSERT INTO cat_sales_one
> SELECT catcode, datesold, sum(extprice) as sumextprice
> FROM mo_sold_extprice, pn_sc, category
> WHERE mo_sold_extprice.pn = pn_sc.pn
> AND pn_sc.sc = category.sc
> AND div = 'T'
> GROUP BY cat, datesold, div
>
> here are the tables.
>
> mo_sold_extprice
> LOC NOT NULL VARCHAR2(4)
> PARTNO NOT NULL VARCHAR2(18)
> DATESOLD NOT NULL DATE
> QTY FLOAT(126)
> EXTDN FLOAT(126)
> DIV VARCHAR2(1)
>
> pn_sc
> PARTNO NOT NULL VARCHAR2(18)
> SC VARCHAR2(4)
>
> category
> SC NOT NULL VARCHAR2(4)
> CATCODE NOT NULL VARCHAR(2)
> SCDESC VARCHAR2(30)
You are likely getting dups because you have bad data.
Daniel A. Morgan Received on Thu Aug 23 2001 - 18:02:26 CDT