find partial duplicated rows in a SQL table in IBM netezza database -


this question related previous question :

error of finding distinct cobinations of muiltiple columns in ibm netezza sql table

now, need find partial duplicated rows in table in sql ibm netteza aiginity workbench.

the table :

id1   id2    **id3    id4  id5   id6**   id7  id8   id9 ny    63689  eiof   394  9761   9318   2846  2319  215 ny    63689  eiof   394  9761   9318   97614 648   645 ct    39631  pfef  92169 9418   9167   164   3494  34 ct    39631  pfef  92169 9418   9167   3649  7789  568  id3    id4  id5   id6  duplicated id1 = ny , id2 = 63689 id3    id4  id5   id6  duplicated id1 = ct , id2 = 39631 

the result should be

 id1   id2    value  ny    63689  2     ct    39631  2 

update: need count partial duplicated id3 id4 id5 id6 each id1 , id2. not care columns of id7, id8, id9.

i used sql query:

 select  id1,       id2,   count(*)   value (   select     id1, id2, id3, id4, id5, id6       mytable   group     id1, id2, id3, id4, id5, id6 )   uniques group   id1, id2 

but, got:

   id1   id2    value    ny    63689  number of combinations of id7  id8   id9       ct    39631  number of combinations of id7  id8   id9    

any appreciated.

the following query produces output want. want do?

select  id1, id2, count(*)   value mytable group id1, id2; 

edit:

if want complete duplicates (of columns) show first two:

select  id1, id2, count(*) value mytable group id1, id2, id3, id4, id5, id6; 

you can add having count(*) > 1 if want examples duplicates.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -