Displaying the records records which are coming more than once

hi
create table temp(comp_id int,branch_id int);
comp_id | branch_id
---------+-----------
1000 | 1
1000 | 1
1000 | 2
1000 | 2
1000 | 3
2000 | 1
2000 | 1
2000 | 2
2000 | 3
how can i write a query which displays the records records which are coming more than once on the basis of fields comp_id and branch_id. e.g. 1000 | 1 should be displayed because it is coming more than once. 1000 | 3 should not be, because it has a single entry.

select comp_id, branch_id, count(*)
from temp
group by comp_id, branch_id
having count(*)>1
Please note this forum is not a SQL class and it is not the place to have your homework done.
Sybrand Bakker
Senior Oracle DBA

Similar Messages

  • The same SMS messages are showing more than once

    Hi,
    On my SMS page, my message threads are showing up more than once ,
    How would I go about fixing this?

    Hello,
    Maybe helps you:
    *[http://kb.mozillazine.org/Repeatably_downloading_the_same_messages]

  • Should not fetch  the records which has tran_efct_dte more than 550 days

    I have a table BRKG_TRA AND below is the structure of the table
    BRKG_ORDER_ID     VARCHAR2(15 BYTE)
    BRKG_ORDER_ID_CNTX_CDE     VARCHAR2(10 BYTE)
    BRKG_ACCT_SIDE_CDE     CHAR(1 BYTE)
    TRD_FTR     NUMBER(15,9)
    PGM_ORIG_TRAN_ID     VARCHAR2(6 BYTE)
    BRKG_OPT_OPEN_CLOS_CDE     VARCHAR2(5 BYTE)
    BRKG_ORDER_QTY     NUMBER(17,4)
    TRAN_ID     VARCHAR2(20 BYTE)
    TRAN_CNTX_CDE     VARCHAR2(10 BYTE)
    CRTE_PGM     VARCHAR2(50 BYTE)
    CRTE_TSTP     DATE
    UPDT_PGM     VARCHAR2(50 BYTE)
    UPDT_TSTP     DATE
    DATA_GRP_CDE     VARCHAR2(10 BYTE)
    TRAN_EFCT_DTE     DATE

    select * from <table name> where <dt_field> > sysdate - 550

  • Query to ignore the records which are 6 months older

    I need a query to ignore the records which are 6 months older . my table is having a column named quote_date . I need to ignore the records whose quote date is 6 months older . Can any one help me in this regard.
    thanks in advance
    rakesh

    Hi:
    SELECT *
      FROM table_name
    WHERE MONTHS_BETWEEN (SYSDATE, quote_date) > 6HTH
    Saad,

  • I accidently closed my window with all my app tabs, now the only window that opens was a 2nd one I had open. How do I get back all my app tabs from the previous window, and why didn't it give me the usual warning you are closing more than one tab?

    I accidently closed the window with all my frequently used app tabs, now the only window that opens was an extra one I had opened. How do I get back all my app tabs from the previous window, and why didn't it give me the usual warning you are closing more than one tab? edit
    Details

    Then the (App) tabs from that window are lost unless you can restore an older copy of the sessionstore.js file (Time Machine?) that has that lost window.
    *http://kb.mozillazine.org/sessionstore.js

  • Hi anyone please help .. i am facing issue with acrobat 11 pro version, in acrobat 7  we are able to compare 2 pdfs which are having more than 1000 pages but in acrobat 111 pro it not possible , if try do so acrobat will unresponsive.. please let me know

    please let me know how can resolve this issue... how can i compare 2 pdfs which are having more than 1000 pages.
    Acrobat

    please let me know how can resolve this issue... how can i compare 2 pdfs which are having more than 1000 pages.
    Acrobat

  • Select the same attribute in a query more than once

    Hi Experts,
    My requirement is to select the same attribute in a query more than once.
    How can I acheive this?
    Expecting an early solution..
    Pilliga

    Hi,
    Create a calculated attribute that just displays the "same attribute".
    (Note: you will need to uniquely name this object).
    For example, if you wish to display Emp Name twice in the same query, then create a calculated attribute called Emp Name2 and select it and Emp Name in your query and the same info will be displayed twice in your results set.
    Cheers,
    Tanish

  • Changing the Window Color of an JInternalFrame more than once

    I want to change the color of an JInternalFrame when it was created. This could be more than once.
    I know that i can use:
    UIManager.put("InternalFrame.activeTitleBackground", Color.RED);
    but this code only takes effect before the InternalFrame is createt

    You are using iPhoto 9 (11)? If you are then the themes would be obvious when you select iPhoto as your mail client in iPhoto's General preference pane (upper left hand image)
    Click to view full size
    and then use the Share ➙ Email button
    Click to view full size
    to get this window:
    Click to view full size
    However, I was mistaken in that the background colors for those themes can't be changed. The same goes for the stationary themes in Mail.

  • Restrict the receipt of same serial number more than once

    Hi,
    I want to restrict the same serial number to be taken in the stock more than once..
    Can somebody guide how to acheive this..
    At the same time I have the indicator set of auto creation of serial numbers at the time of goods receipt in serial number profile.
    e.g. I posted 2 material documents (101) one with material A and another with material B with the same serial number S
    when I check the serial number S in transaction code IQ03, it is showing against 2 mat. codes. I dont want this scenario to occur.

    IN IQ03 , you have to put both the material number and serial number.
    The serial number is tied to material number. Hence, different material number can have the same serial number.

  • Can we export the records which are failed on an validation

    Hi
    My Question is after a validation is run on an record in the data manager,I like to extract the records from Data Manager,with the validation success(Tick) and failed(X) column which is generated by the system for each validation.
    As the validation fields in the Data manager are system fields , is it possible to extract ?, is there any other workaround for this.
    As in my system there are 10 validations which are grouped in to a validation group.when i run the validation group, i want to take a report kind of recordswith the validation Name Fields (tick) and (x) in to an excel or any format.
    Regards
    Sowseel.

    Hello Sowseel.
    In DM FreeFormSearch you have expression field - you can use it for create filter. and than export all selected records.
    You can create special field and use assignment with similar as you validation rule
    Assignment wil put expression result to that field (in fact - validation result)
    Then you can extract records with validation result.
    Regards
    Kanstantsin Chernichenka

  • Messages in on-error coming more than once.

    Hi
    Iam working in Forms 10g.
    Iam over-riding on-error and on-message triggers in my form.
    Assume below as my on-error code:
    message(error_type || '-' || to_char(error_code));
    I have a date item with below code in its key-next-item trigger.
    if :blk.item1 > sysdate then
    Message('greater than sydate);
    end if;
    if :blk.item1 < sysdate then
    Message('less than sydate);
    end if;
    Here is my issue:
    I run the form and give a negative test case for the date field, ie. enter value 'asdf' for the date field.
    Now iam getting on-error fired twice and getting the error message twice. ie. am getting on-error fired as many times i refer the date item in the key-next-item trigger.
    But i need to get the error only once and not twice or thrice.
    Please suggest me how to solve this.
    Thanks
    Sriram

    Thanks
    I tried both raise form_trigger_failure as well as return but still am getting on-error firing as many times the field reference in the trigger. We are doing maintenance of client's application and i cannot remove the existing key-next-item functionality.
    The client application has lot of validations in key-next-item and post-change. Whenever we face date validations in these triggers, we are getting on-error fired as many times the number of date field reference in the trigger.
    Iam trying to fix the issue in on-error itself but i couldn't. As of now i found a work-around which is given below.
    In on-error i have below code:
    show_alert(error_message);
    if error_code in (50025,50026) then
    raise form_trigger_failure;
    end if;
    So when ever i get "Invalid date" error, iam making the form status failure.
    In my key-next-item
    if :blk.item1 > sysdate then
    Message('greater than sydate);
    end if;
    IF NOT FORM_SUCCESS THEN
    RAISE FORM_TRIGGER_FAILURE;
    END IF;
    if :blk.item1 < sysdate then
    Message('less than sydate);
    end if;
    (Note: The code in upper case is the one that i added newly.
    So if i give an invalid date for :blk.item1 iam getting on-error fired, then iam making form status failure, then in key-next-item iam checking if form status is failure then raise. )
    This is just an work around but practically it is not possible for me to give this work around in so many triggers, it will be great if i can able to raise the error only 1 time in on-error.
    I think i have stated the issue clearly. Please help me to give a fix in on-error itself.
    Thanks
    Sriram

  • TS3276 the connection dr. shows my acounts more than once

    I cannot send emails from any of my accounts(I have 3) everything was fine yesterday, this morning i went to send an email and I cannot. the connection Dr. shows my accounts 2 times - Once with a green dot but also shows them(repeated beneath the green dots) with red dots? The Network connection button is greyed out? Any suggestions.

    Thank you for your reply. I started doing as you suggested, I was hoping I could delete the offending accounts through the Connection Dr.(wishfull thinking) Only because the Offending accounts are also the green dot accounts. For some reason they are repeated: so I have a hotmail acct that is both a green and a red dot I have a Go Daddy account that is both green and Red - I cant even take them all "offline" and put them back "online" because according the status in the Mail Application the accounts are "online" but according to the preferences>accounts>outgoing mail sever they are all "offline". very confusing especially considering They work fine one night the next morning all this. I will try your advice I was nervous I would loose everything if i deleted the account but I am realizing now that shouldn't happen. Thanks again for your help.

  • Recording a DVD-R more than once

    Does anyone know how I can do a multisession recording on a DVD -R?

    You can't, as the DVD-R format doesn't support this. If your drive is capable of writing to DVD+R disks, you can burn a multisession DVD+R with third-party software. The Disk Utility doesn't support burning multisession DVDs. To check if your drive supports DVD+R disks, open the Terminal in your /Applications/Utilities/ folder and type or paste in the following:
    drutil info
    All the types of disks supported by your drive will be listed in the output.
    (8652)

  • Why does the message alert tone repeats itself more than once?

    every once in a while my message alert tone repeats itself while a message is delivered. if i switch off and switch on the problem gets resolved only for a while.

    Check your Settings > Notifications > Messages > Repeat Alert ?

  • The same incoming message shows up more than once. Why?

    After deleting message it shows up again in inbox. Time it takes second message to appear varies.
    Roy

    Hello,
    Maybe helps you:
    *[http://kb.mozillazine.org/Repeatably_downloading_the_same_messages]

Maybe you are looking for

  • Sharing media across my home network, in more ways than one...

    Hi, Bear with me, because I can only just get my head around this myself: I would like to have a network accessible hard drive to which I can store all the photos, music and video in my home. The devices accessing it are a MacBook Pro (10.5.3), a Mac

  • Converting PDF to XSTRING for Adobe in WD ABAP Application

    I have a requirement to develop a WD abap application in the portal, where 300 PDF's would exist on our LAN all with the pernr number embedded in the name.  When a user logs onto the portal, it would retrieve the correct PDF for their pernr and displ

  • Tab delimited file not getting loaded properly in OWB

    Hi, I have create a flat file module and liked it to an external table in OWB, but out of 5000 records only 3000 are getting loaded into external table for tab delimited flat file. Could any body has any idea how this is happening. Thanks Ram

  • Problem in deleting row from database in table component

    Hi, I have a table component that its content change by diffrent links. in this table i have a hyperlink in each row to deleting that row from dataBase. so i must get the current row . i do it like this: define a rowset in the page that have a delete

  • Document Create

    Hello Friends, I am using BAPI_DOCUMENT_CREATE2 to create the documents withinside the loop, at first time things works fine, and it create me the document. but second time ( with in loop ) it thorws me error ( msg id ZVC and MSG NO 11 )... I debug t