Combine in a single line: check the box Case() and Group BY

Hello

I have a little problem and it seems my knowledge and possession is simply not enough good to slove it.

To better understand my question here an example (the actual query is too large):
Data:
NAME, CASE_NO, GO_TAG
Tom 10 GB
Tom 15 GB
Tom 20
30 Tim
Tim 40

My query looks like this:
SELECT NAME,
CASE
WHEN (GO_TAG IS NOT NULL) THEN wm_concat (CASE_NO)
ANOTHER NULL
END WITH_GO_TAG
CASE
When wm_concat (CASE_NO) (GO_TAG IS NULL) THEN
ANOTHER NULL
END WITHOUT_GO_TAG
GROUP BY NAME, GO_TAG;


Now what I get output:
NAME, WITH_GO_TAG, WITHOUT_GO_TAG
Tom, 10, 15', "
Tom, ", '20'
Tom, 10, 15', "
Tom, cm, 30, 40'

Here's my problem: I want a line instead of two lines for "Tom."
It looks like: Tom, 10 ', 15', 20'

Is this possible?

You should know that I coded those SQL things to right directly in this forum to show you my problem... hope you can understand it :-)

Hope someone can help me in this case.

Oh, almost forgot, I (or better: my company) use Oracle Version: 10g

See you soon,.
Phil

Hello

Thank you. It's clearer.

Did you count 5 lines of sample data, or 10?
In SQL * Plus, when you finish an order with one; and then have a /, the / means "repeat the last command. So, when I run

INSERT INTO EXAMPLE VALUES
('Tom', 10, 'go');
/ 

I get 2 identical rows. I suppose you want only 1.

When you say ' GROUP BY name, go_tag ', the output contains a line for each distinct combination of name and go_tag.
If you want just one row for each distinct value of the name, just say 'GROUP BY name. If we are not group by go_tag, we must be careful that any reference to go_tag in the SELECT clause is like an aggregation function argument, like this:

SELECT     NAME,
           STRAGG (NVL2 (go_tag, case_no, NULL))     AS with_go_tag,
           STRAGG (NVL2 (go_tag, NULL,    case_no))     AS without_go_tag
    FROM   EXAMPLE
GROUP BY   NAME;

NVL2 (a, x, y) is equivalent to
CASES WHERE an IS NOT NULL THEN x ELSE y END to this problem, I found NVL2 easier than CASES to read and understand, but I don't maintain your code, then you should use your way of thinking is the best.

Tags: Database

Similar Questions

  • DM4x comes with DM4t label on the box, case, and memory

    I bought a Pavilion model dm4x # LX130AV and received today. Box, case and even the memory of the computer model as a #LX State! 25AV, which is a Pavilion dm4t. I spent hours on the phone w/4 different CS representatives, who have all insisted that the serial number of checks that it is, in fact, a dm4x. I do not understand it being shipped in the wrong box, even the bad case... but the memory? I asked an RMA number and he'll be back. Has anyone else had this experience? Thank you.

    Same question on this topic, see the answer to Matt_Lo

    http://h30434.www3.HP.com/T5/other-notebook-PC-questions/wrong-model/m-p/797299/highlight/false#M28413

    Basically, a dm4x is not a real model number, x is a placeholder to represent a whole subset of models like the dm4t

  • Graphics problems with a single line at the top.

    During bootup until I perfect video resolution, but after starting windows I have a single line of the video of the ideas would be useful. I already checked the wiring, video card and the BIOS settings. Anyone had this problem? This had beat me my head against the wall for a week now.

    I'm just guessing that you have a problem with
    your video driver. Maybe the info will be
    be useful...

    Good luck...

    What happens if you start in Mode safe?

    (315222) a Description of the Safe Mode
    Boot into Windows XP options
    http://support.Microsoft.com/?kbid=315222

    How to start safe mode in Windows XP
    http://bertk.MVPs.org/html/SafeMode.html

    If you start correctly in safe mode... it can
    be worth a try to roll back your video driver.

    (306546) HOW to: use the driver to restore roll back feature
    a previous Version of a device in Windows XP driver
    http://support.Microsoft.com/default.aspx?scid=kb;en-us;306546

  • Firefox does not allow me to check the box "Remember passwords for sites". What should I do?

    I have iAntivirus, not Norton or McAfee. Wanted to install "remember passwords" and "remember pass" are not add-ons, but the key to the right arrows and after removing these 2 modules I can't check the box "remember password for sites". What should I do? I really want to save my passwords.

    Hello romkom, you can not save passwords when you chose to always run firefox in private browsing mode in the Preferences > privacy Panel...

  • Firefox will not save my passwords for all sites, I checked the options, securtit and marked the box to save passwords. Any suggestions?

    Firefox will not save my passwords for any site. I checked the box 'Save password'. I tried several times over several days.

    Any suggestions?

    Under the Privacy tab, check box "remember history". My sister had the same problem, and this box is unchecked in its version. Please try it out.

  • When "allow pages to choose their own colors, instead of my selections above" is not checked in the menu options, I can't see images on Web sites. How can I maintain with the box unchecked and always display images?

    I recently decided to spend autour colours in Firefox. I work in a fairly dark environment and have the dark color on white or light background text is quite difficult on my eyes in the dark.

    I changed the background to a dark gray, light gray text and visited the two and links not visited in a blue light. With these changes, I unchecked the "allow pages to choose their own colors, instead of my selections above" box.

    After unchecking the box, I'm more able to display images on many sites. Turn all grey images - as if Firefox has changed their image in part of the background. When I check the box, I am able to see fine pictures, however, Web sites typically return to their light background with dark text.

    Any help and assistance with this is greatly appreciated!
    Thank you!

    You can use the NoSquint extension to define the font size (zoom text/page) and colors of text on web pages.

  • Why Firefox «ask» when I checked the box 'don't ask me '?

    When you try to open media as something of an email, Firefox always shows me the window asking me to check which software program to use when opening the file, even though I checked what, to use and the box 'don't ask me. " I also checked the box 'always use this program ". It is very annoying.

    is always

    This occurs because the file that you download is an accessory, so Firefox will always ask you what you want to do with the file.

    This is a security feature, since attachments can often contain harmful files. So there's no way to automatically open an attachment without asking you first. This box can be confusing when it appears in a download of attachments, given that the setting does not apply to the attachments.

  • Satellite L450D - Mic/Line in the box for don't show

    Hello

    I hope someone can tell me how to get the mic line in the box to appear when I plug the microphone etc as I want to use the line to record sounds from another source. IE using the tv headphone plug.
    It ceased to appear automatically for some reason. I think it is defined on the mic setting as the sound he recorded was very thin even to listen to return with my helmet.

    OR y at - it another way to record sound from the tv to the laptop.
    Any help much appreciated
    Jay

    Hello

    Try to reinstall a sound card driver, it must appear that I hope...

    http://EU.computers.Toshiba-Europe.com/innovation/download_drivers_bios.jsp

  • When I check the box to me connected, when I sign keep, it does not keep me logged on Windows Live.

    Original title: keep me connected

    When I check the box to keep me connected, when I sign, it dose not keep me connected. What can I do?

    Hello

    You can ask your questions on the links of the following forums.

    http://answers.Microsoft.com/en-us/windowslive/Forum/LIVEmail

  • In the Internet properties and connections and the local network settings, I uncheck the box for a proxy server, but in a few moments, the computer checks the box

    In the Internet properties and connections and the local network settings, I uncheck the box for a proxy server (because it is blocking my access to Internet Explorer), but within moments, the computer checks the box. What can I do to stop the area of the check proxy server box?

    original title: LAN settings

    Have you checked for viruses?

    http://www.eset.com/us/online-scanner/

    It is very common that the virus to do.

  • Apply for a job that an i marked the days I can work a TI says that I have not checked the boxes

    I am to apply for a job a TI says check the box to indacate what days I am free to work, so I check, a TI goes back to the page saying I did not mark the box, I'am so ask what she could be, how can I fix it, if it can be fixed!

    Thank you

    Bettyjo Applehans

    Hi Bettyjo Applehans,

    1. what happens on the only site?

    If so, you will need to contact site support.

    Step 1:

    You can temporarily disable a security software and firewall installed on the system and check if the problem persists.

    Note: Be sure to enable the security software on the computer after checking.

    Step 2:

    If you use Internet Explorer, then you can try to disable temporarily add ons and check if it helps:

    Steps to open Internet with no mode of modules:

    a. click on start

    (b) in the search box, type in Internet explore

    c. Select Internet (no add-on mode)

    For further ifnroation, please see the following article

    How the modules of the browser affect my computer?

    Hope this information is useful.

  • I connect to outlook and put my email address and full security in when I disconnect and reconnect I must sign in everyntime even after checking the box to keep me connected?

    e-mail Outlook for windows 7does won't keep me signed in, I save my e-mail and security question to keep me signed in but after that I have close and open later he always wants me to re sign in? ... Joseph thanks, even after signing, constantly checking the box to keep me in...

    Hi Joseph,

    1. what browser do you use on your computer?

    2. is the specific question to Outlook.com or all web mail?

    I suggest you follow the steps described in the link if you are using Internet Explorer and let us know the State of the question below.

    Automatically fill in website forms and passwords:

    http://Windows.Microsoft.com/en-in/Windows7/fill-in-website-forms-and-passwords-automatically

    I hope this helps.

  • PDFMaker, Options, create PDF/A-1 a in Word. Where can I change the setting so I did not check the box for each file, I create?

    PDFMaker, Options, create PDF/A-1 a in Word. Where can I change the setting so I did not check the box for each file, I create?

    Win OS: Windows 7

    Acrobat 9 Pro

    Hello

    You can do this to change the registry settings.

    Go to run type Regedit to open it.

    First make a backup of the registry.

    Here is how do.

    Go to HKEY_CURRENT_USER > software > Adobe > Acrobat > PDFMaker 9.0 > > Word > settings

    You need to change the DWORD values & chain listed below.

    Chain: JobOptions

    Value: PDFA1b 2005 RGB

    DWORD: PDFComplianceIndex

    Value: 1

    DWORD: PDFComplianceLevel

    Value: 1

    Close the registry editor

    Thank you

    Abhishek

  • Why not an edited image is not at the Organizer even if I check the boxes that indicate that it should?

    I imported a photo in the Organizer.  Now I edit this photo and I check the boxes indicating the program to put the image in the organizer and also the image with the original pile.  Can I save the image.  When I return to the Organizer, 9 times out of 10, the image won't be there, which seems strange, is that once in a while where I worked on the image will appear in the Organizer as it is supposed to, but is most of the time it won't.  This requires me to manually import the image published in the organizer and then manually put the image with the original sound.  It's frustrating because it takes the time it should not.  Can anyone help?

    What is your version of elements?

    What you describe looks like a bug in PSE12. This has been fixed by an update: use the menu help/update.

  • Despite checking the box "don't import suspected duplicates", my Lr4 still re - import hundreds of photos. Anyone know how to avoid this?

    Despite checking the box "don't import suspected duplicates", Lr4 still re - import hundreds of photos of the same exact card, they were imported original. Anyone know what I should do differently next time?

    The problem of duplicate detection is that, as far as I know, Lightroom uses details that it detects on the imported file (looking at the EXIF data and drop stats) and what is already in the catalog. Unless it finds an exact match for all parameters, the file is not a duplicate. From my own experience, if Lightroom decides that a file is a duplicate is almost always correct. However, when missing, it really lacks. I have not read anywhere that Lightroom is built and store a hash number, which would make the process more accurate. I also suspect that the search for duplicates is when you import a series of photos of a place (a card for example) and they are stored in the same folder, all the time. So, if you take a memory card and import all photos to Folder_X and try again later, and reimport the same photos in Folder_X, Lightroom will catch that they are duplicates. But if you import Folder_Y of this same group of photos, Lightroom intercepts not it indicating that the comparison is not large catalog. I'm not sure of how to influence this behavior and it is not anything that you hurt or did not. It's just like that...

Maybe you are looking for