Problem in finding the Duplicate as well as Non-Duplicate count

Hi,
I have a scenario where I have a table TABLEA which has 3 values
10 ABC
10 ABC
20 DEF
I want to pick up the duplicate count as wel as non duplicate count:
I have used the following query:
SELECT COUNT(*) FROM TABLEA A WHERE A.ROWID > ANY (
SELECT B.ROWID FROM TABLEA B WHERE
A.CODE=B.CODE)
But I am finding problem in getting the non-duplicate count .
Any help will be needful for me
Edited by: user598986 on Sep 23, 2009 11:32 PM

user598986 wrote:
Hi,
I have a scenario where I have a table TABLEA which has 3 values
10 ABC
10 ABC
20 DEF
I want to pick up the duplicate count as wel as non duplicate count:
I have used the following query:
SELECT COUNT(*) FROM TABLEA A WHERE A.ROWID > ANY (
SELECT B.ROWID FROM TABLEA B WHERE
A.CODE=B.CODE)
But I am finding problem in getting the non-duplicate count .
Any help will be needful for me
Edited by: user598986 on Sep 23, 2009 11:32 PMHi,
perhaps this query makes your job:
HR: XE > select * from test_;
NAME           SALARY HIRE_DATE START_DAT END_DATE
                      15-SEP-09 15-SEP-09
                      15-SEP-09 01-DEC-09
john                  27-AUG-09 16-SEP-09 16-SEP-10
                      28-FEB-09 20-SEP-09
Dave                2 17-JUN-08 16-SEP-09 02-JUL-11
                 1000 21-AUG-82 08-MAY-10
6 rows selected.
HR: XE > select count(hire_date), hire_date from test_
  2  group by hire_date;
COUNT(HIRE_DATE) HIRE_DATE
               1 27-AUG-09
               1 21-AUG-82
               2 15-SEP-09
               1 28-FEB-09
               1 17-JUN-08
HR: XE > select count(id), id from
  2  (
  3  select hire_date, 'simple' id from test_
  4  minus
  5  select test_.hire_date, 'simple' id
  6  from test_
  7  where test_.hire_date In (Select hire_date FROM test_  GROUP BY hire_date HAVING Count(*)>1 )
  8  union all
  9  select test_.hire_date, 'double' id
10  from test_
11  where test_.hire_date In (Select hire_date FROM test_  GROUP BY hire_date HAVING Count(*)>1 )
12  )
13  group by id;
COUNT(ID) ID
         2 double
         4 simple
HR: XE > Regards,
Ion

Similar Messages

  • How to find the PREVIOUS value of a non-DB item?

    I want to do a simple thing but found it impossible.
    I want to find the previous value of a non-DB item in a form.
    I tried creating a text item and populating it using PRE-TEXT-ITEM but that does not work.
    WHEN-VALIDATE-ITEM does not work either because WVI fires only after item value has changed.
    Any suggestions will be greatly appreciated.
    Edited by: Channa on Apr 2, 2010 4:34 AM

    Channa wrote:
    I want to do a simple thing but found it impossible.
    I want to find the previous value of a non-DB item in a form.
    I tried creating a text item and populating it using PRE-TEXT-ITEM but that does not work.
    WHEN-VALIDATE-ITEM does not work either because WVI fires only after item value has changed.
    Any suggestions will be greatly appreciated.
    Edited by: Channa on Apr 2, 2010 4:34 AMPlease make it clear what is your requirement then possibly we can provide you a better answer
    You can use Global variables for to store old values also on Post-query populate a value in separate field or Parameter

  • Problem to find the javax.media.jai package

    hi everyone!! it's not the first time I ask this question, but i have troubles to find javax.media.jai..
    I've downloaded the jai 1.1 and everything is fine... However, I have to use classes from the javax.media.jai... I made the import, and it doesn't find it, as if it doesn't exist... Someone tells me that the jai contained it, so why doesn't it find it??
    i'm using a java version 1.2.. do you think that is the problem?
    thanks a lot, and sorry for my bad english!!
    Anne.

    thanks a lot!!! it helps me but doesn't resolve my problem!! ;o)
    you may be right,, it's a classpath problem. well i work under unix, so i have to give my classpath by the command setenv CLASSPATH ...
    i didn't find the jai_core.jar in my JAI 1.1, I have only the BugFixes.jar...
    I tried to download the latest version of JAI, and unfortunately i have a new problem with the .tar, i don't manage to "open" it... the command
    tar xvf [archieve file] gives me some errors!!
    so I don't know what I'm gonna do.... I think I'm going to ask someone to send me the package, or the specific classes I need, it would be more easier!!
    Thanks
    Anne.

  • Problem in finding the link location of a particular address

    hello,
    i am developing a travelling salesman problem project using oracle 10g utilities and the APRESS book's data.
    shortly, in the system, the user enters the address info and the application records each address info (when user enters it) to use it in the future to find the shortest path.
    however, there is a problem like this: in the NET_LINKS_SF table, there are many link_name column values which have the same values but have different link_id values.(it shows that one street may consist of more than one link.) thus, while determining the link_id of a particular address (which was entered by the user and will be used in the determination of the shortest path (such as start_node_id, end_node_id)), i am not able to use the other tables in the datasource because every table containing a column whose value is the same as net_links_sf.link_name value only refers to the first link_id of a particular link_name. in other words, i am not able to reach the second, third or fourth link of a particular link from the other tables. in order to achieve it, i need the link_id value of the link. however, of course, the end user who will use the system cannot know the link_id values of the addresses.
    shortly, i need to reach the link_id values of the addresses using address information of the addresses. however, in the data of the APRESS book, the other tables dont allow me to implement it. how can i realize my idea?
    if you want, i can write here all the decriptions of the tables.
    note: while getting the system worked, i am using the start_node_id and end_node_id values to determine the nodes to be visited by the salesman. if you recommend me to realize it using another technique, i also ask you to write your proposal.
    i hope my question is clear. if you want extra explanation, i can write it immediately. i look forward to take a response.
    best regards

    one anecdote:
    i use the GC_POI_US table to determine the spesific addresses to be used in the shortest path analysis.

  • Problem in finding the datasources for master data for 0TCT_MC11

    Hi,
    I want to load the data in 0TCT_MC11(BI7) , which is one of the technical content multiprovider. I have a datasource to load data in it , but I am not able to find the data source for the master data objects. hence I am stopped in doing loading to this MP. Can some body let me know where can I get the Information about the Datasources to load master data.
    Thanks,
    Jeetu

    Hi Srilatha,
    While reading data from 0TCT_MC11 through query I am getting the following message...(query name 0TCT_MC11_Q0130)
    "Error while reading data; navigation is possible
    "Value XY2CLNT400AHPL_ACCT"
    "You are trying to load the invalid characteristic value 1. (hexidecimal representation 0044004200320043004C004E00540036003000300049004F00)."
    Please let me know if you have any suggestions for this.
    Thanks, Jeetu

  • HT4623 the Icons on my iphone 4...suddenly get extreemly large, I don't know why.  I can't use the phone when this happens, I have to shut off the phone, which is a problem, just finding the red arrow and making it go across the screen to shut down...help

    does anyone know what is going on with my phone?  I don't think I'm causing this, but you never know.  my home page where the phone, camera, messages, etc...all the icons will get giant....maybe 3 will be on the screen instead of the normal 20.....I have to move the screen around to find what I need to open and then I cannot...so I turn off the phone, when the red arrow appears, and have to hold down one side of the screen to make the arrow move, If I try to slide it over with my finger..........I can't get it to the end.....eventually the phone will shut off and then I turn it on again and the icons are normal....but this happens several times a week and I would like it not to happen , what can I do?

    Thank You, thank You ...so much......that feature made me crazy!  
    Ocean20 wrote:
    This can be turned off in settings/accessibility/zoom. Then on the next screen turn off

  • Problem in finding the Communication channels under configuration

    helo all.
    i want to look at communication channels under cd1 (businness system)but i couldnt found.
    but when i take a look at these through my neighboous systems i did find those.
    can any body tell me wat would be the story behind this and do i need to have any settings under my system in XI.
    waiitng for u r response.
    bye.
    regards.
    seeta ram.

    Hi,
    If the objects are activated then u must be able to see it. Have u checked in the objects tab...where all the CC are listed under their respective business systems. Are you trying with ur user id in ur colleagues comp or their user id..?? Try to refresh the cache.
    Thanks!!

  • Module pool ---Problem in finding the line index for the table control

    Hi Friends,
    I am working in Module pool programming.
    My requirement is when i select any record on the lead selection I need to find out the index of the line on which  row i have selected.
    Could any one please suggest me the proper solution how to get the line index for the table control in module pool programming.
    Thanks
    Satish Raju

    Hi Raju,
    Follow the steps
    <li>U should take one variable in your internal table or in structure which is used for table control fields.
          DATA :BEGIN OF itab OCCURS 0 ,
                mark TYPE c ,
                matnr LIKE mara-matnr ,
                matkl LIKE mara-matkl,
                maktx LIKE makt-maktx,
            END OF itab .
       controls: tabc types tableview using screen 100.
    <li>This mark variable should be given in Table control properties. follow the path
    double click on the table control-->attributes .->select w/SelColumn and in that give itab-mark.
    <li>Flow logic of the screen
       process before output.
         MODULE status_0100.
         LOOP AT itab with control tabc
         endloop.
       process after input.
         module cancel at exit-command.
         LOOP AT itab.
           MODULE read_table_control.
         ENDLOOP.
         MODULE user_command_0100.
    <li>read_table_control module code
         MODULE read_table_control INPUT.
         MODIFY itab INDEX tabc-current_line."this will update the itab table
                                             "mark field with 'X ' whatever we
                                             "have selected on table control
         ENDMODULE.
    <li>If you want to Delete some of the records from Table control follow this code u2026Create one pushbutton and give Fucnction code to that and write below code
       CASE okcode.
         WHEN 'DELETE'.
           LOOP AT itab WHERE mark = 'X'.
             DELETE itab.
           ENDLOOP.
       ENDCASE.
    I hope that it helps you.
    Thanks
    Venkat.O

  • Problem in finding the field in the structure

    hi,
             i have to find out whether one name is exist as a field name in one structure. how to make this comparison. pls let me know.
                                                                         thanks,
                                                                    mukka.chakradhar.

    SELECT single matnr from dd03l into v_matnr where tabname = 'MARA' and as4local = 'A'.
    check sy-subrc = 0.
    DD03L  table contains all the active status table names with all the fields in the table
    Message was edited by:
            Hymavathi Oruganti

  • Linkage problem : cannot find the linkage instance

    Hello everyone,
    I'm trying to create a linkage to swap movie clip dynamically. I already create a linkage and after my movie clip symbol actuall say Export: contact_idea. But when I try to attachMovie("contact_idea"). It does nothing. Is there anyway that I can test that the linkage is actuall linked?
    Thanks

    Thank you very much for your reply. But I still have the problem.
    This is my situation.
    on my stage _root stage I have a movie clip named "head". In movie clip head also have movieclips, "part", and "MC_Holder" which play simultaneously. In "part" movieclip, I have a button which is supposed to be clicked and play "MC_Holder" movieclip which I have the problem.
    this is my code in my button in "part" movieclip
            _root.head.MC_Holder.gotoAndPlay("48");
            _root.head.MC_Holder.removeMovieClip();
            _root.head.MC_Holder.attachMovie("contact_idea","newidea",this.getNextHighestDepth());
            _root.head.MC_Holder.gotoAndPlay("48");
    _root.head is the movieclip in root which doesn't have any problem calling it.
    "contact_idea" is the linkage in my library, which I stated earlier that I linked it already and it displayed a symbol Export: contact_idea.
    Thank you very much for all of you.

  • Problem in finding the total count

    my table as below:
    ID code group cand
    A 001 01 1
    A 001 02 1
    A 001 02 2
    A 002 01 1
    A 003 01 1
    B 001 01 1
    B 001 01 2
    B 001 02 1
    B 002 01 1
    C 002 01 1
    C 002 01 2
    C 003 01 1
    Here is what I want
    ID Code tot_grp num_cand
    A 001 4 3
    A 002 4 1
    A 003 4 1
    B 001 3 3
    B 002 3 1
    C 002 2 2
    C 003 2 1
    where tot_grp is the total number of groups for each ID
    and num_cand is the total number of candidates for each ID with that specific
    code
    Can I do it in one sql statement ?
    Thank you

    you said
    where tot_grp is the total number of groups for each ID
    and num_cand is the total number of candidates for each ID with that specific
    code
    Can u be more specific what should be present in tot_grp column.
    Is it contains
    a)sum of group for a given ID & code combination.
    If yes then sql would be
    select id,code,sum(group) tot_grp,count(cand) num_cand
    from <table_name>
    group by id,code
    having the output ID Code tot_grp num_cand
    A 001 5 3
    A 002 1 1
    A 003 1 1
    B 001 4 3
    B 002 1 1
    C 002 2 2
    C 003 1 1
    2) Total No of groups(only the count) for a given Id & code
    If yes then sql would be
    select id,code,count(group) tot_grp,count(cand) num_cand
    from <table_name>
    group by id,code
    having the output ID Code tot_grp num_cand
    A 001 3 3
    A 002 1 1
    A 003 1 1
    B 001 3 3
    B 002 1 1
    C 002 2 2
    C 003 1 1
    If none of the above condition is correct can u please be more clear .

  • Problem in finding the following fields!

    compiler code
    compiler desc
    language code
    language desc
    runtime band code
    runtime band desc

    Hi,
      Could you please send the details in which transaction and in which screen these fields are.
    Cheers,
    Bujji

  • Problem in finding the url

    i am providing the url "C:\\Documents and Settings\\snehasis\\My Documents\\aa.gif" for an image located "C:\\Documents and Settings\\snehasis\\My Documents\\aa.gif") and it is throwing an error. It is due to the path not found .how to rectify it

    Review the documentation for the method you are using and determine what argument it takes. You are providing a string consisting of a file path/name. Is that valid?

  • Find the invoices po wise and non po wise

    hi guys i'm working on oracle 10g r2
    my question is
    i have 2 tables
    ap_invoices_all
    ap_invoice_lines_all
    select invoice_id from ap_invoices_all where invoice_num = '1010'output is
    invoice_id
    100now query 2nd table
    select * from ap_invoice_lines_all where invoice_id = 100output is [assum jus 2 or 3 columns]
    invoice_id-----------line_type------------po_header_id
    100---------------------item-----------------400
    100---------------------tax------------------null
    100---------------------tax-------------------nullmy question is i want to check if ap_invoice_lines_all have po_header_id in respect of invoice_id then it will be show in po_invoices categories
    i have make a query like this
    select * from ap_invoices_all i
    where invoice_num = '1010'
    and exists ( select 1 from ap_invoice_lines_all
    where invoice_id = i.invoice_id and po_header_id is null)above query also shows me the records why?? because ap_invoice_lines_all have 3 lines 2 have null in po_header_id columns ..
    my simple question is i want jus checked in ap_invoice_lines_all table if po_header_id is not null in corresponding invoices then it shows me INVOICES PO_WISE otherwise it cant show in
    INVOICES NON-PO-WISE
    my this test case shows in both ways [INVOCIES PO WISE] and [INVOICES NON-PO WISE] . i want dat record shud be show in INVOICES PO WISE only .
    help

    Pl do not post duplicate threads - how to find po_invoices and non-po_invoices
    Srini

  • I can't download applications because of freaking credit cards can't find the click and buy or none there's only 3 options visa MasterCard and Amex can anyone help me please........

    Can anyone please help solve my problem regarding the credit card option so I can download free application from app store there no options for clickandbuy or none Thera only 3 options VISA,MasterCard and Amex.....please I really need help here".........

    This page explains how to create an account without a credit card (I'm not sure whether it's possible in all countries) : http://support.apple.com/kb/HT2534

Maybe you are looking for

  • Creation of Object Dependency (OD)

    Hi Gurus, Currently we have customized a program to create/update object dependencies. However we have a problem that sometimes the object dependency is deleted and not updated back. As we cannot simulate this all the time (especially during debuggin

  • Can't open TIF file.

    I've tried to open the file in Preview, but I get this message (as others have): "The file could not be opened.  It may be damaged or use a file format tha Preview doesn't recognize." So then I followed other directions, which said to right click and

  • Sending form as pdf attachment instead of xml

    I have created a form for the web where clients may fill it out and submit it to an email address. I had hoped this would be a pdf file, but it is coming as an xml file. How do i change it to pdf? Thanks in advance. Bob

  • Harman Kardon SoundSticks II with iPad?

    Dear all, did someone try the Harman Kardon SoundSticks II together with the iPAD? Apparently there is no sound control on the Harman Kardon SoundSticks II. The price and the sound is good on the Harman Kardon SoundSticks II, but would you recommend

  • Macbook Pro wifi stops working, won't turn back on, requires restart to fix?

    So for the last two days my Macbook Pro's being doing something very strange. At random times, the wifi will just stop working (as in it thinks I have wifi but no webpages load anymore and my dropbox can't sync) and when I go to turn the wifi off and