How can i select the duplicate values

Hi experts ,
how can i find the duplicate values from the table. i want to display the all duplicate the rows.
1. Table Structure :-
CREATE TABLE CIF_MIGRATE
  LINE_NO        NUMBER(10),
  ACCT_NO        VARCHAR2(20 BYTE),
  BRANCH_ID      VARCHAR2(1 BYTE),
  CUSTOMER_NAME  VARCHAR2(100 BYTE),
  FATHER_NAME    VARCHAR2(100 BYTE),
  GF_NAME        VARCHAR2(100 BYTE),
  TOTAL          VARCHAR2(100 BYTE),
  STATUS         VARCHAR2(100 BYTE),
  CUSTOMER_TYPE  VARCHAR2(10 BYTE),
  GENDER         VARCHAR2(10 BYTE)
) 2. Sample Data:-
SET DEFINE OFF;
Insert into CIF_MIGRATE
   (LINE_NO, BRANCH_ID, CUSTOMER_NAME, CUSTOMER_TYPE)
Values
   (72, '1', 'Addis Belay Construction Material Rental', 'C');
Insert into CIF_MIGRATE
   (LINE_NO, BRANCH_ID, CUSTOMER_NAME, CUSTOMER_TYPE)
Values
   (73, '1', 'Addis Belay Construction Material Rental', 'C');
SET DEFINE OFF;
Insert into CIF_MIGRATE
   (LINE_NO, BRANCH_ID, CUSTOMER_NAME, FATHER_NAME, CUSTOMER_TYPE, GENDER)
Values
   (2869, '1', 'Abraham', 'Fiseha',
    'I', 'Male');
Insert into CIF_MIGRATE
   (LINE_NO, BRANCH_ID, CUSTOMER_NAME, FATHER_NAME, CUSTOMER_TYPE, GENDER)
Values
   (2870, '9', 'Abraham', 'Fiseha',
    'I', 'Male');
Insert into CIF_MIGRATE
   (LINE_NO, BRANCH_ID, CUSTOMER_NAME, FATHER_NAME, GF_NAME, CUSTOMER_TYPE, GENDER)
Values
   (2872, '9', 'Abraham', 'Baraki',
    'Medehniye', 'I', 'Female');
Insert into CIF_MIGRATE
   (LINE_NO, BRANCH_ID, CUSTOMER_NAME, FATHER_NAME, GF_NAME, CUSTOMER_TYPE, GENDER)
Values
   (2873, '1', 'Abraham', 'Geber kirstos',
    'gebre medihin', 'I', 'Female');
Insert into CIF_MIGRATE
   (LINE_NO, BRANCH_ID, CUSTOMER_NAME, FATHER_NAME, GF_NAME, CUSTOMER_TYPE)
Values
   (2874, '1', 'Abraham', 'Gebre egziabher',
    'Negussie', 'I');
COMMIT;4. My requirement is i need display all the duplication customer
CUSTOMER_NAME                                 FATHER_NAME,GF_NAME
Addis Belay Construction Material Rental   
Addis Belay Construction Material Rental
Abraham                                              Fiseha
Abraham                                              Fiseha5. I tried below query but i cant reach what i want exactly
SELECT CUSTOMER_NAME,FATHER_NAME,GF_NAME
                           FROM CIF_MIGRATE
                      GROUP BY CUSTOMER_NAME,FATHER_NAME,GF_NAME
                         HAVING COUNT (*) > 1kindly suggest me the solution
Thanks
Arun

Hi,
You're on the right track using COUNT (*), but, for this job, you want the analytic COUNT, not the aggregate COUNT.
"GROUP BY x, y, z" means that the result set will only contain 1 row for each distinct combination of x, y and z. Most aggregate functions (including COUNT) have analytic counterparts that get the same results without reducing the number of rows.
Here's one way you can use the analytic COUNT function:
WITH     got_cnt          AS
     SELECT    customer_name
     ,       father_name
     ,       gf_name
     ,       COUNT (*) OVER ( PARTITION BY  customer_name
                           ,                 father_name
                     ,           gf_name
                     )     AS cnt
     FROM       cif_migrate
SELECT    customer_name
,       father_name
,       gf_name
FROM       got_cnt
WHERE       cnt     > 1
;PARTITION BY in analytic functions corresponds to GROUP BY in aggregate functions.

Similar Messages

  • How can we select the highest value from 3 disfferent #defined values???

    Hello,
    Sometimes I come across the requirement of having the program automatically select the highest value
    among several defined preprocessor command statements. For example:
    #include "stdio.h"
    #include <math.h>
    #define _K_BUF_OTHERS 20
    #define _k_BUF_ENV_TAGS 30
    #define _k_BUF_REGS 40
    #define _k_MAX(x, y, z) (max((max(x, y)), z))
    int main(){
    unsigned int u;
    u = _k_MAX(_k_BUF_OTHERS,_k_BUF_ENV_TAGS, _k_BUF_REGS);
    return 0;
    In the sample above we have three (3) different define statements called :
    _k_BUF_OTHERS
    _k_BUF_ENV_TAGS
    _k_BUF_REGS
    but at any given time in certain C modules (In this case above, the main.c module) I require for the program to know
    which of the three is the highest and get that highest value so I can use it downstream of my code. In this case the highest would be 40. So therefore putting the following macro anywhere in my code should make a text substitution of the macro's value
    and return 40 to u:
    u = _k_MAX(_k_BUF_OTHERS, _k_BUF_ENV_TAGS, _k_BUF_REGS);
    But I can't even compile the program!
    Here's the error I get in VC++:
    1>------ Build started: Project: MinMax, Configuration: Debug Win32 ------
    1>  Source1.cpp
    1>c:\c++_tests\minmax\minmax\source1.cpp(15): error C3861: 'max': identifier not found
    1>c:\c++_tests\minmax\minmax\source1.cpp(15): error C3861: 'max': identifier not found
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    Can someone please have a look and see what I am doing wrong.
    All help appreciated...
    Thanks
    r

    On 4/12/2015 4:30 PM, roberto wrote:
     1>c:\c++_tests\minmax\minmax\source1.cpp(15): error C3861: 'max': identifier not found
    So implement or #define one. C standard library doesn't provide a function named "max".
    Igor Tandetnik

  • How can I select the time values of a signal and connect them to the y-input of a divide command?

    Hi,
    I have an analog signal connected with a threshold peak detector. The counted peaks shall be divided by the total time of the recorded signal. My problem is, I don't know how to connect just the the x-values, i.e. the time component of the signal, to the divide command. I have no idea how to "split" the signal so that I don't have the whole signal but just the time in seconds as an output of the measured or filtered signal sub-VI, respectively.
    Does anyone have a hint?
    Thanks for your help,
    Philipp

    Hi Phillipp,
    do you mean you have a waveform and you want to get the components? In this case "Get Waveform Components" should work.
    Mike

  • How can I get the default value of a particular preference programatically. I know I can see the default value for some of the preferences in about:config but, I need a programatic way to get the default value.

    <blockquote>Locked by Moderator as a duplicate/re-post.
    Please continue the discussion in this thread: [tiki-view_forum_thread.php?comments_parentId=702631&forumId=1]
    Thanks - c</blockquote>
    == Issue
    ==
    I have a problem with my bookmarks, cookies, history or settings
    == Description
    ==
    How can I get the default value of a particular preference in FireFox?.
    I know I can see the default value for some of the preferences in about:config but, I need a programatic way to get the default value.
    I see some that there are values for preferences in firefox.cs but I am not certain that these are being used as the default values for preferences. prefs.js in user's profile only has the updated values and not the default values.
    Any help towards acheiving this programtically is greatly appreciated.
    If the default values are stored in a file, kindly let me know the format in which it is stored for me to parse it programatically.
    == User Agent
    ==
    Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Win64; x64; Trident/4.0; .NET CLR 2.0.50727; SLCC2; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0)

    Dear Friend,
    Here when you have the callableSattement as ?=proc(?), the first ? is an output parameter. So you should register it as out parameter using registeroutparameter.
    Then you can get the value from the outparameter using callablestatement.getXXX().
    Try that way.
    For free tral versions of JDBC Drivers go to www.Atinav.com

  • How can I select the existing worksheet while using OLE2 to open the template workboo

    Source:
    application:=ole2.create_obj('Excel.Application');
    workbooks:=ole2.get_obj_property(application,'Workbooks');
    args := ole2.create_arglist;
    ole2.add_arg(args, 'c:\RptTemplate.xlt');
    workbook:=ole2.invoke_obj(workbooks,'Open',args);
    ole2.destroy_arglist(args);
    worksheets:=ole2.get_obj_property(application,'Worksheets');
    args := ole2.create_arglist;
    ole2.add_arg(args, 'Sheet1');      
    worksheet     :=ole2.invoke_obj(worksheets,'Select',args);
    ole2.destroy_arglist(args);
    Problem:
    1. While executing the above code, error -305500 occurs after executing "worksheet := ole2.invoke_obj(worksheets','Select',args)". How can I select the sheet i wanted in the template ??
    2. As I refer to the forms on-line document, it stated that the ole2 programmers documentation can provide all object types and methods that can be used with the OLE2. Does any link can provided to download the specified documentation ??

    The error is probably that your Worksheets variable is actually empty. Looking at your code I think the problem is that you try and get the value of the worksheets collection from the application then you should try and get it from the Workbooks object.

  • How can I avoid the null values in cross tab?

    How can I avoid the null values in cross tab?

    Hello Anindita,
    Let me explain you the problem in detail.
    I have selected User and Program as rows in the cross tab. In Summarized Field I am counting the Programs.
    In DB I can have both User and Program null.
    Letu2019s take these scenarios...
    1) For a User, Program can be null
    2) For a Program, User can be null
    3) And both can be null.
    A null Program does not give problem since Cross tab does not count the null values and in my case too, it remove the Program which are null from the Cross tab because of the counting its doing on Program. Hence scenario 1 and 3 is not a Problem.
    Problem comes in scenario 2 (For a Program, User can be null).
    In this case since Program is not null it will get counted and will be grouped under null user but I donu2019t want to show the null user Grouping in my cross tab.
    "Suppress empty rows" and "suppress empty colums" does not help.
    Thanks & Regards,
    Amrita

  • How can I findout the coulm value contains 0 through 9 for the table

    could u plz suggest me how can I findout the coulm value contains <> 0 through 9 for the table...

    Well I am going to give it a shot, because I believe I am looking for the same thing.
    I have a value that is of type varchar2. How can I determine if it has special characters or alpha characters in it? In other words, I only want the value to consist of numbers. (Initially it had been thought that Letters would be used as well, but now they just want numbers and the datatype of the column cannot be altered since there is data in it.)
    I have gotten this far, but I do not know what else I can use besides '[:alpha:]'? I cannot seem to find this documented anywhere...I can find the regexp package reference, but not the character classes...
    select regexp_instr('1a23456', '[[:alpha:]]',1,1,1, 'i') x
    from dual
    This works fine = returns 3, so I know there is an alpha character.
    select regexp_instr('1$23456', '[[:alpha:]]',1,1,1, 'i') x
    from dual
    This returns 0 - what do I need to change so that it detects the '$' and returns 3?
    Thanks!!
    Janel

  • How can i get the all values from the Property file to Hashtable?

    how can i get the all values from the Property file to Hashtable?
    ok,consider my property file name is pro.PROPERTIES
    and it contain
    8326=sun developer
    4306=sun java developer
    3943=java developer
    how can i get the all keys & values from the pro.PROPERTIES to hashtable
    plz help guys..............

    The Properties class is already a subclass of Hashtable. So if you have a Properties object, you already have a Hashtable. So all you need to do is the first part of that:Properties props = new Properties();
    InputStream is = new FileInputStream("tivoli.properties");
    props.load(is);

  • How can I get the edited value from the editor in JTable

    I have a JTextField added as an editor to a cell in JTable.
    I value gets changed when I press enter.
    but in actionPerformed of the JTextField when I say
    String txtEditorValue = txtEditor.getText();
    I am getting the old value. How can I get the edited value? Thanks.

    Hi,
    I guess, your understanding of how JTable works together with its models is not good enough - for example the method getTableCellEditorComponent(...) of the TableCellEditor interface is used to get the component, that should be used as editing component - its second parameter is a value that should be used to setup the editing component - it is normally not the editing component itself.
    JTable uses an underlying TableModel to store the cell values - if you have edited a cell, JTable gets the value of the editing component by itself and stores it in the TableModel using its setValueAt(...) method. To retrieve this data you only need to query the TableModel using row and column of this cell as parameters
    say jt is your JTable, and row and column are the row and column of the cell - so to get the value, simply use
    Object obj = jt.getModel().getValueAt(row,column);
    if you know, that there is a String in this cell use
    String str = (String) jt.getModel().getValueAt(row,column);
    The editor component is used for the view of the JTable - you only want the data, which is stored in the model - you don't have to deal with the GUI components in this case.
    greetings Marsian

  • How can i pass the Input value to the sql file in the korn shell ??

    Hi,
    How can i pass the Input value to the sql file in the korn shell ??
    I have to pass the 4 different values to the sql file and each time i pass the value it has to generate the txt file for that value like wise it has to generate the 4 files at each run.
    can any one help me out.
    Raja

    Can you please more elaberate., perhaps you should more elaberate.
    sqlplus is a program. you start it from the korn shell. when it's finished, processing control returns to the korn shell. the korn shell and sqlplus do not communicate back and forth.
    so "spool the output from .sql file to some txt file from k shell, while passing the input parameters to the sql file from korn shell" makes no sense.

  • How can I reference the last value in a column?

    How can I reference the last value in a column? For example, today I want the value of A1 to appear in another cell. Tomorrow, I will add a row and want to reference A2, next day A3, and so forth.

    Now I got it:
    =OFFSET(A1,COUNT(A)-1,0)

  • I'm trying to install an update to itunes that downloaded but can't complete installation as its trying to install onto D: drive. I don't have a D drive and i'm not given option of selecting the drive to install on. How can i select the drive that i want

    I'm trying to install itunes but can't complete installation as its trying to install onto F: drive. I don't have a F drive and I'm not given option of selecting the drive to install on. How can I select the drive that i want to install on?

    Hi,
    How do you connect the printer to the XP machine ? If USB, you need to make that machine as a Print server. Please try this:
       http://techtips.salon.com/make-windows-computer-pr​int-server-11914.html
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • How can i select the next column instead of next row when press enter key

    I need to know how can i select the next column instead of next row when i press the enter key.By default ,when i press enter key the next row is selected and the column remain unchanged but I wants opposite that is the row should remain unchanged but column index will changed.
    Thanks to all.

    Well, the right arrow key will already move you to the next column, so the easiest way to do this is to modify the InputMap to have the Enter key invoke the same Action as the right arrow key.
    You can search the forum for my "Table Actions" (without the space) example that will show you how to do this.

  • How can i write the floats value in Unitronics vision230 plc using modbus Ethernet

           How can i write the Float value in unitronics Vision230 PLC usinsg modbus ethernet (MB Ethernet Master Query.vi) I  read and write  the 32 bit register,  for e.g i want to write the 23.45 value on 2nd add. of MF. And MF register is 32 bit register. I  read and write  the 32 bit register.
    Narendra.
    Solved!
    Go to Solution.

     Thanks Amit for your solution but i can not use the string to write the value because  MB Ethernet master Query.vi only accepet the integer value its not take string values or any other i.e floats values etc.....otherwise i have  no problem to write or read the 32 bit register values , only problem is that the MB Ethernet master Query.vi only accept the integer value there4 how can write the float value.
    Narendra
    Message Edited by Artemistech on 01-30-2009 11:06 PM

  • In Jsp TagLib how can I get the Attribute value (like JavaBean) in jsp

    Dear Friends,
    TagLib how can I get the Attribute value (like JavaBean) in jsp .
    I do this thing.
    public void setPageContext(PageContext p) {
              pc = p;
    pc.setAttribute("id", new String("1") );
              pc.setAttribute("first_name",new String("Siddharth")); //,pc.SESSION_SCOPE);
              pc.setAttribute("last_name", new String("singh"));
    but in Jsp
    <td>
    <%=pageContext.getAttribute("first_name"); %>
    cause null is returing.
    Pls HELP me
    with regards
    Siddharth Singh

    First, there is no need to pass in the page context to the tag. It already is present. How you get to it depends on what type of tag:
    Using [url http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/SimpleTagSupport.html]SimpleTagSupport
    public class MyTag extends SimpleTagSupport
      public void doTag()
        PageContext pc = (PageContext)getJspContext();
        pc.setAttribute("first_name", "Siddharth");
        pc.setAttribute("last_name", "Singh");
        pc.setAttribute("id", "1");
    }Using [url http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/TagSupport.html]TagSupport or it's subclass [url http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/jsp/tagext/BodyTagSupport.html]BodyTagSupport the page context is aleady declared as an implicit object:
    public class MyTag extends TagSupport
      public void doStartTag()
        pageContext.setAttribute("first_name", "Siddharth");
        pageContext.setAttribute("last_name", "Singh");
        pageContext.setAttribute("id", "1");
    }In each case, this sort of thing should work:
    <mytags:MyTag />
    <%= pageContext.getAttribute("first_name") %>I

Maybe you are looking for