Printing records that count more than 1 based of 3 fields.

Hi: I have this table below. I want to print list of USERIDs that have different USERID, SHORTNAME and COMPANY combination. One of the USERID I want to print below is jkova since there are two records for jkova that have different COMPANY and SHORTNAME. I expect all records for each any given USERID to have the same COMPANY and SHORTNAME values.
descr USERINCISUMMSTATUS;
USERID         NOT NULL VARCHAR2(32)
DEVICENAME     NULL     VARCHAR2(64)
COMPANY        NULL     VARCHAR2(50)
SHORTNAME      NULL     VARCHAR2(15)
remedy@MDS> select USERID,COMPANY,SHORTNAME,DEVICENAME from USERINCISUMMSTATUS where USERID='jkoval';
USERID COMPANY     SHORTNAME DEVICENAME
jkova  ABC         925669382 466904984
jkova  Exmacs      carx      587465874I have tried the following and it does not print correct.
SELECT USERID||COMPANY||SHORTNAME, count(USERID||COMPANY||SHORTNAME) AS CNT from USERINCISUMMSTATUS where USERTYPE='E'
group by USERID||COMPANY||SHORTNAME having count(USERID||COMPANY||SHORTNAME) > 1;Could someone help.
Thanks
RavI

SQL> set linesize 132
SQL> with USERINCISUMMSTATUS as
  2  (select 'jkova1' userid, 'ABC' company, '925669382' shortname, 466904984 dname from dual union
all
  3   select 'jkova1' userid, 'Exmacs' company, 'carx' shortname,587465874 dname from dual union all
  4   select 'jkova2' userid, 'Exmacs' company, 'carx' shortname,587465874 dname from dual union all
  5   select 'jkova2' userid, 'Exmacs' company, 'cary' shortname,587465874 dname from dual)
  6  SELECT  USERID,
  7          COMPANY,
  8          SHORTNAME
  9    FROM  (
10           SELECT  USERID,
11                   COMPANY,
12                   SHORTNAME,
13                   COUNT(DISTINCT COMPANY || CHR(0) || SHORTNAME) OVER(PARTITION BY USERID) CNT
14             FROM  USERINCISUMMSTATUS
15  --           WHERE USERTYPE='E'
16          )
17    WHERE CNT > 1
18  /
USERID COMPAN SHORTNAME
jkova1 ABC    925669382
jkova1 Exmacs carx
jkova2 Exmacs carx
jkova2 Exmacs cary
SQL> with tbl as
  2  (select 'jkova1' userid, 'ABC' cmp, '925669382' shortname, 466904984 dname from dual union all
  3   select 'jkova1' userid, 'Exmacs' cmp, 'carx' shortname,587465874 dname from dual union all
  4   select 'jkova2' userid, 'Exmacs' cmp, 'carx' shortname,587465874 dname from dual union all
  5   select 'jkova2' userid, 'Exmacs' cmp, 'cary' shortname,587465874 dname from dual)
  6   select userid, cmp, shortname, dname
  7   from   (select tbl.*,
  8                  count(distinct cmp) over (partition by userid) nb_cmp,
  9                  count(distinct cmp) over (partition by userid) nb_shname
10           from tbl)
11   where  nb_cmp>1
12   and    nb_shname>1;
USERID CMP    SHORTNAME      DNAME
jkova1 ABC    925669382  466904984
jkova1 Exmacs carx       587465874
SQL>  SY.

Similar Messages

  • How to insert a detail record that has more than one master record

    I have a somewhat complex situation that I am triying to figure out. I have three tables A, B and C. Table C is a detail table that has a foreign key to table A and table B. There are is nothing else in table C (basically it's used to create a many to many relationship between A and B.
    Now I have a application module method that based on some user provided data needs to insert records in tables A and B and link them using table C. I have view links (and associations) between A and C as well as B and C. I can easily go from A and insert (via the view link accessor) a record into C. My problem is that I don't know how to the take that same C row and add it to B as a detail.
    I have kinda hacked it by creating a row in B, using postChanges to get it's primary key ID and set the attribute directly in C. It works but I was hoping to find a way to avoid calling postChanges possibly hundreds of times in a loop. I also cannot commit the AM until the process is completed.
    I tried setting the "composition association" on both associations but that didn't work either.
    Thanks

    I'm not sure if this helps, but here's a web page which talks about Image I/O:
    http://java.sun.com/products/java-media/jai/iio.html
    For your problem, they have a sample solution which can read a specific page of a multi-page tiff file, so perhaps you could make a loop to read all of the pages:
    http://java.sun.com/products/java-media/jai/forDevelopers/samples/MultiPageRead.java
    Good luck!

  • Text that spans more than one cell in a JTable

    Hi all.
    I have a JTable where I've altered the renderer so that it looks like I have columns that span more than one cell.
    e.g.: http://i.imgur.com/RSGOh.png
    From that image though you will notice that the text (which is based in a JLabel) is truncated.
    I need this text to span the available cells so was wondering about the best way of doing it.
    I could:
    1) When I know that the text won't fit, don't draw anything at all with the renderer but make a note of it and then in the paintComponent method of the JTable, paint the text in the appropriate position once the rendering has been done.
    2) Provide a custom renderer that draws as much of the text as possible up to the right edge, and then have an adjacent cell renderer paint the rest.
    3) Use a different TableUI that when I know I need to span, uses a special renderer to stamp over the spanned cells...
    4) other methods???
    I was going to attempt choice 1) but thought I'd ask here first in case someone has had experience in this and knows the "correct" way to do it.
    Is this the right way to go about it?
    Thanks, Nick.

    // Allow selection to span one contiguous set of rows, visible columns, or block of cells
    table.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
    // Allow multiple selections of rows, visible columns, or cell blocks
    table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

  • Query to retrieve the records which have more than one assignment_id

    Hello,
    I am trying to write a query to retrieve all the records from the table per_all_assignments_f which has more than one different assignment_id for each person_id. Below is the query i have written but this retrieves the records even if a person_id has duplicate assignment_id's but i need records which have more than one assignement_id with no duplicates for each person_id
    select assignment_id ,person_id, assignment_id
    From per_all_assignments_f
    having count(assignment_id) >1
    group by person_id, assignment_id
    Thank You.
    PK

    Maybe something like this?
    select *
    From   per_all_assignments_f f1
    where  exists (select 1
                   from   per_all_assignments_f f2
                   where  f2.person_id = f1.person_id
                   and    f2.assignment_id != f1.assignment_id
                  );Edited by: SomeoneElse on May 7, 2010 2:23 PM
    (you can add a DISTINCT to the outer query if you need to)

  • Need to write a query that takes more than 2 minutes to execute

    Hi ,
    I am using Oracle 10g as my DataBase.
    I am writing a small program for Testing purpose , in that my requirement is to write a query that takes more than 2 minutes to execute .Right now i have only a small Table called as "Users" with very less data .
    Please let me know how can i achieve this thing ??
    Thanks .

    So please tell me , how can i achieve this . Thanks in advance .P. Forstman's example above will probably be more reliable, but here's an example of my idea - harder to control timing (untested)
    select count(*)
      from dba_objects o, dba_tables t, dba_tab_columns tc
    where o.object_name||'' = t.table_name||''
       and o.owner||'' = t.owner||''
      and t.table_name||'' = tc.table_name
      and t.owner||'' = tc.owner||''

  • HT202299 Is there a way to automatically upload videos that last more than 5 minutes on icloud ?

    I saw that icloud has a limitation of 5 minutes on the videos :
    Is there a way to automatically upload videos that last more than 5 minutes from iphoto/photos ?
    I'm trying to find a way to store my photo library on the cloud, AND keep to acces to each photos/videos from the net (not just storing the .iphotolibrary on the icloud folder) but i cant do it for the videos of more than 5min ...

    I believe you are probably referring to iCloud photo sharing. If you wait a while, the next version of Yosemite will include the new Photos application which will sync video through the iCloud photo library feature.

  • I have a 16GB san disc that when more than half full and trying to download to my Mac gives a "communication error" message.  How can I seamlessly upgrade the computers software to handle SDHC cards of this size?

    I have a 16GB San Disc that when more than half full and trying to transfer the images to the iPhoto library I get the message "communication error".  How can I update my computers software to be SDHC compatable?  I can buy a card reader but thought an update to the software would fix this problem.
    Thank you for any solutions or advice.

    KRDHarris-
    I am not familiar with Flickr, but found their support page at <Flickr Support>. You may get better help there than here.  I get the impression that the App is somewhat buggy.
    The iTunes preview page indicates the App is for iPad as well as the iPhone.  <Flickr App Preview>
    Fred

  • I am trying to copy more or less 30G from my MacbookPro to an external hard drive and it is stuck in the "preparing to copy" step. But that for more than one hour. What should I do to make it faster? Thanks a lot in advance!

    I am trying to copy more or less 30G from my MacbookPro to an external hard drive and it is stuck in the "preparing to copy" step. But that for more than one hour. What should I do to make it faster? Thanks a lot in advance!

    Thanks Shootist007, by blockd files I mean files that I have changed to blocked and when I tried to move then for the first time, I had to unblock again. I am trying to backup my pictures, my songs and other files like word documents and excel tables. First I put all of them as blocked, what caused the first problems on trying to move them. Then, I've unchecked the block option and if I try to move one by one, there is no problem. The issue is to move all together, because it gets stuck in the preparing to copy files step. Anyway, if I cannot do all by once, I'll do it one by one, event though that was not suposed to happen if we are talking about technology, right? Anyway, I thank you again for trying to help me!

  • In Music, sometimes an album that has more than one artist, only one shows up, how do I get them all that are all on the album to play in sequence when I select that album?

    I can't figure out why, on my ipod touch in Music, when I select some albums that have more than one artist, the whole album doesn't come up to play all together.  This happens in some compilations, and only ne song shows up from each artist on the album.  Or like on an artist's album that has someone else singing with her.  I get that they are on the same line as an artist, but the album is an album, and when you play an album, the whole thing should play - right?  Thanks for your help!

    Generally all you need do is give tracks from the same album a common Album Artist. See Grouping tracks into albums. The images need an update but the basic info. still holds.
    tt2

  • My iPod doesn't work. The screen is black but it has a ticking circle in the middle. Its been stuck like that for more than an hour. My iTunes doesnt recognize the iPod Touch and says 'iTunes could nit connect to this iPhone-unknown error

    Its been stuck like that for more than an hour. My iTunes doesnt recognize the iPod Touch and says 'iTunes could nit connect to this iPhone-unknown error

    I'm soooo sorry to bump this but MAYBE someone will know what to do?! I've just tried EVERYTHING. I need help. Please, anyone?!
    *last chance and I'm backing away sloooowly*
    thanks to ANYONE who will suggest ANYTHING at all!!!

  • I would like to ask whether anyone knows of any true explanation for why the iPhone 5 starts at $199 in the US and £529 in the UK? That is more than a £400 discrepancy...

    I would like to ask whether anyone knows of any true explanation for why the iPhone 5 starts at $199 in the US and £529 in the UK? That is more than a £400 discrepancy...
    iPhones are duty free and even with a $50 shipping fee it would only come to £185.75 including VAT at the current exchange rate.

    How much a month is the standard 24month contract with AT&amp;T or one of the other American providers that makes the handset cost $199?
    Here's the cheapest plans available from the big three:
    The plans start there and can run up to $230/mo (for AT&T).

  • HT201318 How can I get a storage plan on iCloud that's more than 50GB?

    How can I get a storage plan on iCloud that's more than 50GB?

    Welcome to the Apple Community.
    If you purchase a higher-tier storage plan for your iCloud account to replace your existing storage plan (for example, a 20 GB plan to replace a 10 GB plan), the existing plan will be canceled and you will receive a prorated refund for the time remaining. The new storage plan is applied to your iCloud account and the annual payment date is updated to reflect the purchase date for the new plan.
    http://support.apple.com/kb/HT4874

  • I'm having trouble with my iCloud photos. I thought i could be a little sneaky and take a photo of my photos that were more than 30 days old, so they would be uploaded along with my new photos. that part worked, but i can't upload them to Snapfish?!

    i'm having trouble with my iCloud photos. I thought i could be a little sneaky and take a photo of my photos that were more than 30 days old, so they would be uploaded along with my new photos. that part worked, but i can't select them to upload them to Snapfish?! Any thoughts? I'm bummed. I've got a few hundred photos on my iPhone that I'd like to move seemlessly - or somehow at all.

    hopefully something in here is helpful?
    http://support.apple.com/kb/HT4486

  • Hi, I tried to create a slideshow that contain more than 500 photos. Now, trying to open / execute / select the slideshow, iPhoto hangs with the spinning coloured wheel and I have only to force the deletion from System Preference. Any suggestion?

    Hi, I tried to create a slideshow that contain more than 500 photos. Now, trying to open / execute / select the slideshow, iPhoto hangs with the spinning coloured wheel and I have only to force the deletion from System Preference. I already tried to rebuild the iPhoto Library (all the possible options) and tried to update teh version from 9.4.3 to 9.5 but the problem still persists: is there a way to delete this slideshow without selecting it ? How can I solve the problem, please?
    Kind Regards

    Can you restore your iPhoto Library from a backup version, that was created before you added the slideshow?
    If not, have you tried to rebuild the slideshow with iPhoto Library Manager?
    As described by Terence Devlin here:  Re: iphoto library was created with an unrelased version of iphoto please quit and ugrade library by opening it in iphoto 2 or iphoto 4

  • 140063685933 this is the receipt no Apart of two purchase there all rest I never received was a problem with the system they couldn't be download and naw you are charging me  Haw unprofessional is that and more than an hour can't find how to get to custom

    140063685933 this is the receipt no
    Apart of two purchase there all rest I never received was a problem with the system they couldn't be download and naw you are charging me
    Haw unprofessional is that and more than an hour can't find how to get to customer service to correct the mistake
    Just so fed up will never ever pitches anything waiting of time and money  

    Apple is not here. Apple does not answer questions here. There are only volunteer users here.
    The charge to your credit card takes place before you download the app.
    If you are having problems downloading the apps that you bought, you will need to explain the issue in detail if you wish someone to help you.

Maybe you are looking for

  • My iPod crashed and now it won't download anything

    I left my 20G iPod to download all of my music when I went to bed, and when I woke up both it and my computer were frozen. Since then everytime I plug it in it only downloads about 100 to 200 songs and then freezes up again. I've restarted and restor

  • Having trouble with multiple lines of text in a JTable

    Hello, I am trying to use a JTable rather like a table in Word so that as I type text into a cell that row of cells grows in height to accomodate the text typed. I used custom cell editors and renderers to put a JTextField (I think it was) into each

  • Feel stupid, but can't drag n drop to reorganize tracks on zen mi

    I upload a ton of stuff to my micro, but now i have duplicate "folders" for some artists and I want to put all the same artist's tracks into one folder. Can't figure out how to do it's Mostly use micro explorer, and you'd think i could drag and drop,

  • Change output codepage of BACS files

    Hi All, I am smoothing out BACS processing methods and notice that part of the job here is to open the BACS files produced by SAP and resave the file as ANSII encoding from unicode (the files are saved to the App server as opposed to temse). this is

  • Problem establishing connection to information steward (COR-10868)

    I've recently installed information steward 4.2 sp2, but whenever I log in I get the below mentioned error: Unexpected error when processing request for service. Contact your administrator. (COR-10868) I'm using the below environment: BO server: 4.1