How to do this in select?

CREATE TABLE ITEM_IDENTIFIER
ID NUMBER(19) NOT NULL,
IDENTIFIER VARCHAR2(255 BYTE) NOT NULL,
PRIORITY_RANK NUMBER(10),
ITEM_ID NUMBER(19) NOT NULL,
IDENTIFIER_TYPE_ID NUMBER(19) NOT NULL
Insert into ITEM_IDENTIFIER(identifier,priority_rank,item_id,identifier_type_id) values (identifier1,1,116211,14)
Insert into ITEM_IDENTIFIER(identifier,priority_rank,item_id,identifier_type_id) values (unknownIdentifier,2,116211,15)
Insert into ITEM_IDENTIFIER(identifier,priority_rank,item_id,identifier_type_id) values (explicitIdentifier1,5,116211,16)
Insert into ITEM_IDENTIFIER(identifier,priority_rank,item_id,identifier_type_id) values (identifier14_1,1,116212,14)
Insert into ITEM_IDENTIFIER(identifier,priority_rank,item_id,identifier_type_id) values (identifier15_1,1,116212,15)
Insert into ITEM_IDENTIFIER(identifier,priority_rank,item_id,identifier_type_id) values (identifier16_1,1,116212,16)
the id is populated by a trigger that uses a sequence on every insert.
what i want to achieve is using the item_id i want to produce a resultset like this:
given item_id = 116211 i want to get all the values of the identifier column in 1 row something like (Identifier_14, Identifier_15 and identifier_16 are just an alias)
Identifier_14 Identifier_15 Identifier_16 Item_id
identifier1 unknownIdentifier explicitIdentifier1 116211
I know this can be produced by the following statements:
SELECT identifier FROM ITEM_IDENTIFIER WHERE identifier_type_id = 14 AND item_id = 116221
SELECT identifier FROM ITEM_IDENTIFIER WHERE identifier_type_id = 15 AND item_id = 116221
SELECT identifier FROM ITEM_IDENTIFIER WHERE identifier_type_id = 16 AND item_id = 116221
I want to have a single select to do that and produce the above resultset, is that possible?

Sounds like you want to pivot the data.
Search this forum for "pivot" and you'll get loads of examples.
e.g.
Column in to ows

Similar Messages

  • How to do this fields selection.

    I have one requirement like
    I was given 15 fields with the descriptions...I have to put those in may be in table maintenance generator ( am not sure how to display then for selection ) and
    when ever functional consultant edits the above 15 exisiting fields and save...
    I have to write the coding as ...the same fields
    sould be selected again from the table and displayed.

    If you need to use a maintenance view just create a view in SE11 using the provided 15 fields. After saving and activating the view got to SE54 and generated the view maintenance for your view. You can then use your view maintenance to edit/display the data by entering the view name into SM30.
    That way you would not have to write any coding.
    Hope that helps,
    Michael

  • How to make this work selecting advanced record set dreamweaver complains and crashes all the time

    Hi There
    I have met a person who does php and sql work but not with dreamweaver. The code I have works but dreamweaver shows me an error with my record sets and it crash all the time.
    <?php require_once('../Connections/datexdatabase.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    if($_GET['pageID']==''){
        $pageId = 1;
    }else{
        $pageId = $_GET['pageID'];
    mysql_select_db($database_datexdatabase, $datexdatabase);
    $query_rsIndex = "SELECT pages.title, pages.meta_keywords, pages.meta_description, content.header, content.`description`
    FROM pages INNER JOIN content ON pages.id = content.page_id WHERE pages.id = ".$pageId." ORDER BY content.order";
    $rsIndex = mysql_query($query_rsIndex, $datexdatabase) or die(mysql_error());
    $row_rsIndex = mysql_fetch_assoc($rsIndex);
    $totalRows_rsIndex = mysql_num_rows($rsIndex);
    ?>
    <?php do { ?>
            <?php if($row_rsIndex['header'] != 'Introduction'){ ?>
            <b><?php echo $row_rsIndex['header']; ?></b>
            <?php } ?>
            <p><?php echo$row_rsIndex['description']; ?></p>
            <?php } while ($row_rsIndex = mysql_fetch_assoc($rsIndex)); ?>
    <?php
    mysql_free_result($rsIndex);
    ?>
    I am able to join the tables in the advanced recordset but i am getting confused with "" FROM pages INNER JOIN content ON pages.id = content.page_id WHERE pages.id = ".$pageId." ORDER BY content.order";"
    mysql_select_db($database_datexdatabase, $datexdatabase);
    $query_rsIndex = "SELECT pages.title, pages.meta_keywords, pages.meta_description, content.header, content.`description`
    FROM pages INNER JOIN content ON pages.id = content.page_id WHERE pages.id = ".$pageId." ORDER BY content.order";
    My question is how can I use dreamweaver with the advanced recordset with the pageID without dreamweaver crashing 20 times a day
    Regards

    My question is how can I use dreamweaver with the advanced recordset with the pageID without dreamweaver crashing 20 times a day
    Do you get any errors in Dreamweaver when it crashes?
    What version?
    What OS?
    Have you tried trashing recreating the user config folder ( http://kb2.adobe.com/cps/405/kb405604.html#main_user_config )?
    Have you tried trashing the preferences ( http://kb2.adobe.com/cps/839/cpsid_83912.html )?
    Has anything changed on the system recently (from program installs, to system / OS updates)?
    Have you tried creating a new user account on the system to verify there is no corruption in the current user's system data?

  • How to add OBLIGATORY for SELECT-OPTIONS

    Hi experts,
    I can use OBLIGATORY for PARAMETERS
    PARAMETERS :s_WMno  TYPE LINK-LGNUM DEFAULT 'SCA' OBLIGATORY.
    I want to add OBLIGATORY for SELECT-OPTIONS. How to do this?
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME .
        SELECT-OPTIONS:  s_matnr FOR mara-matnr .
    SELECTION-SCREEN END OF BLOCK b1.
    Many thanks.

    Hi,
    TABLES spfli.
    SELECT-OPTIONS : carrid FOR spfli-carrid OBLIGATORY. " This makes only Low field Obligatory
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF screen-name = 'CARRID-HIGH'. " To make High field also obligatory
          screen-required = 1.
          MODIFY SCREEN.
        ENDIF.
      ENDLOOP.
    Cheerz
    Ram

  • I am having problems with the Preview application.  When I try to use it to open a pdf document it gets hung-up and I have to select force quit to close it.   Any ideas on how to resolve this problem?  Thanks for any help

    I am having problems with the Preview application.  When I try to use it to open a pdf document it gets hung-up and I have to select force quit to close it.   Any ideas on how to resolve this problem?  Thanks for any help

    Can you open the Preview program without loading a file, like by itself?
    If it doesn't load then I suspect a corrupt Preview preference file.
    Deleting the System Preference or other .plist file
    Can you open other files with Preview, like jpg's and images?
    How about other PDFs? or is it just that one you have downloaded?
    Run through this list of fixes
    Step by Step to fix your Mac

  • I'm having problems (1)selecting onscreen text, (2) having problems resizing menu boxes and selecting menues with the cursor. I'm not able to select menus and move them. I'm not sure how to correct this.

    I'm having problems (1) selecting onscreen text, (2) resizing menu boxes and selecting menues with the cursor. I'm not able to select menus and move them. I'm not sure how to correct this.

    1) This is because of software version 1.1. See this
    thread for some options as to how to go back to 1.0,
    which will correct the problem...
    http://discussions.apple.com/thread.jspa?threadID=3754
    59&tstart=0
    2) This tends to happen after videos. Give the iPod a
    minute or two to readjust. It should now be more
    accurate.
    3) This?
    iPod shows a folder icon with exclamation
    point
    4) Restore the iPod
    5) Try these...
    iPod Only Shows An Apple Logo and Will Not Start
    Up
    iPod Only Shows An Apple Logo
    I think 3,4, and 5 are related. Try the options I
    posted for each one.
    btabz
    I just noticed that one of the restore methods you posted was to put it into Disk Mode First rather than just use the resstore straight off, I Have tried that and seems to have solved the problem, If it has thank you. previously I have only tried just restoring it skipping this extra step. Hope my iPod stays healthy, if it doesnt its a warrenty job me thinks any way thanks again

  • How can I change (or select) what is being being used when I share, as the file cover. When I Share lets say "Master File" i want to select a frame that is used as the file cover. So when its on my desktop I see this image as the file icon.

    How can I change (or select) what is being being used when I share, as the file cover. When I Share lets say "Master File" i want to select a frame that is used as the file cover. So when its on my desktop I see this image as the file icon.

    I don't think Finder does this (I've tried).
    iTunes does though. Where you can set artwork or the "poster frame"...
    This may not be what you want but if it helps, I know 2 ways  do this is
    Open the video in QuicktimePlayer7 | View | Set Poster Frame (even then, you might need to save it as .mov (ie in a 'mov container').
    Drag the file into iTunes and set the artwork (as in http://www.dummies.com/how-to/content/adding-album-cover-art-or-images-in-itunes .html)
    From there, iTunes will use that frame as the "poster frame" ie the photo/frame that shows when you browse your videos. Which is what you want, but limited to iTunes.
    When I do either of these above, the frame I set does not show when exploring files in "Finder" (or in the other Explorer tool I use called "Pathfinder").
    So it maybe, that exactly what you want, is not possible.

  • When I try to use the internal hard drive as a scratch disk I get this error "unable to set scratch disk- the selected directory is on write protect or non-writable media.  Any ideas on how to fix this.  It only happens in fcp.

    When I try to use the internal hard drive as a scratch disk I get this error "unable to set scratch disk- the selected directory is on write protect or non-writable media.  Any ideas on how to fix this.  It only happens in fcp.

    By internal, I assume you're referring to your systems (boot) drive. Is it, by chance, a partitioned dive?
    Also…although many people successfully use their systems drives as scratch disks, over time you'll have better results using a dedicated drive for your media.
    Good luck.
    Russ

  • Selected from my iphone "Buy more ringtones"and it has dowloaded as a music file how do i get it to be a ring tone which is what should have happened.  Any ideas on how to fix this?

    selected from my iphone "Buy more ringtones"and it has dowloaded as a music file and is now in itunes on my laptop and in music on my iphone. How do i get it to be a ring tone which is what should have happened in the first place.  Any ideas on how to fix this? As in itunes I cannot see how to a) change it to a ring or b) drag across to the right area...
    I simply followed the prompts on my iphone 4s and would have expected it to end up as a ring tone.. any help, guidance, advice welcome...

    selected from my iphone "Buy more ringtones"and it has dowloaded as a music file and is now in itunes on my laptop and in music on my iphone. How do i get it to be a ring tone which is what should have happened in the first place.  Any ideas on how to fix this? As in itunes I cannot see how to a) change it to a ring or b) drag across to the right area...
    I simply followed the prompts on my iphone 4s and would have expected it to end up as a ring tone.. any help, guidance, advice welcome...

  • Hi, While installing XQuatrz-2.7.7, the installation blocks at the "destination" level. It asks how to install this soft, "Install for all users" is shadowed, but frozen: i cannot select anything and move on. Any idea how to get that fixed? Thanks!

    Hi,
    While installing XQuatrz-2.7.7, the installation blocks at the "destination" level. It asks how to install this soft, "Install for all users" is shadowed, but frozen: i cannot select anything and move on. Any idea how to get that fixed?
    Thanks!

    It says above 2 relevant and 1 correct answere available .............
    I'm new here so could anyone direct me to these answeres?

  • Import selected photos button not working, Please tell me how to enable this function.

    in Iphoto on macbook pro, the 'import selected' button blacked out, only 'import all photos' works, pls tell me how to get this to work. i'd like to transfer only selected photos to ipad. Have tried to import by copy/paste method into itunes but still cannot be done, every way i've tried is restricted. I don't want to send all my photos through email. neither do i want to use icloud. all i simply want is to have only selected photos sent through my USB cable connected from my macbook pro to send photos to Ipad. It seems Apple have made these strange restrictions for whatever purpose i don't know.

    If you went through the 5 Rs step by step and you're still having problems, it might be time to find an iPod repair service. Apple will charge you as it's out of warranty. You can probably find third party repair outfits that will do it more cheaply.

  • I am trying to import photo's on i photo.  It downloads all of the pictures on my camera, how do i only select the photos i want?  Is there a way to do this without selecting one photo at a time? is there a way to select multiple images?  thanks!

    I am trying to import photo's on i photo.  It downloads all of the pictures on my camera, how do i only select the photos i want?  Is there a way to do this without selecting one photo at a time? is there a way to select multiple images?  thanks!

    To select consecutive images click and drag the cursor over multiple thumbnails to select all at once.
    To select multiple images that are randomly located hold down the Command(⌘) key and click on those images you want to select.
    Or to select consecutive images from a list of images that are together hold down the Shift key and and click on the first photo you want to select and the on the last photo you want in the list.
    OT

  • I tried to rent a film on my MacBook but it comes up with, In order to rent, you need to authorise this computer. To authorise this computer, select "Authorise Computer..." from the store menu. Where is the store menu and how do I sort it?

    I tried to rent a film on my MacBook but it comes up with, In order to rent, you need to authorise this computer. To authorise this computer, select "Authorise Computer..." from the store menu.
    Where is the Store menu and how do I authorise my computer?
    Please help.
    Thank you.

    Move the cursor to the very top of the computer's screen, click on Store in the menu bar, and choose Authorize this Computer.
    (115518)

  • How to optimize this select statement  its a simple select....

    how to optimize this select statement  as the records in earlier table is abt i million
    and this simplet select statement is not executing and taking lot of time
      SELECT  guid  
                    stcts      
      INTO table gt_corcts
      FROM   corcts
      FOR all entries in gt_mege
      WHERE  /sapsll/corcts~stcts = gt_mege-ctsex
      and /sapsll/corcts~guid_pobj = gt_Sagmeld-guid_pobj.
    regards
    Arora

    Hi Arora,
    Using Package size is very simple and you can avoid the time out and as well as the problem because of memory.  Some time if you have too many records in the internal table, then you will get a short dump called TSV_TNEW_PAGE_ALLOC_FAILED.
    Below is the sample code.
    DATA p_size = 50000
    SELECT field1 field2 field3
       INTO TABLE itab1 PACKAGE SIZE p_size
       FROM dtab
       WHERE <condition>
    Other logic or process on the internal table itab1
    FREE itab1.
    ENDSELECT.
    Here the only problem is you have to put the ENDSELECT.
    How it works
    In the first select it will select 50000 records ( or the p_size you gave).  That will be in the internal table itab1.
    In the second select it will clear the 50000 records already there and append next 50000 records from the database table.
    So care should be taken to do all the logic or process with in select and endselect.
    Some ABAP standards may not allow you to use select-endselect.  But this is the best way to handle huge data without short dumps and memory related problems. 
    I am using this approach.  My data is much more huge than yours.  At an average of atleast 5 millions records per select.
    Good luck and hope this help you.
    Regards,
    Kasthuri Rangan Srinivasan

  • On my new iMac, mail has no sound after waking from sleep.  If I select do not wake for network access in general preferences, the problem does not occur.  Anyone have an idea on how to fix this?

    On my new iMac, mail has no sound after waking from sleep.  If I select do not wake for network access in general preferences, the problem does not occur.  Anyone have an idea on how to fix this? Thanks --

    Same here on an older iMac since Lion. Thanks for the uncheck wake for network access tip though, it doesn't do it either in that case, I will leave it that way.

Maybe you are looking for

  • Change display settings to show mac on tv

    I bought the cables in order for me to hook my macbook pro up to my plasma tv through and hdmi cord and converter.  The first few times I hooked it up I was able to drag the screen over to the tv and it worked perfect, now it is not working and I'm n

  • Trying to link a thumbnail in one frame to a larger image in another frame GOLIVE 9...

    Hi. I am using Adobe Golive 9. I found a tutorial on the internet that allows you to create an image gallery with clickable thumbnails http://www.tutorialhero.com/click-48179-create_an_image_gallery_with_clickable_thumbnails. php However, the tutoria

  • How to organize nay files?

    I have a Server Client application that contains 30 .java files in a single package is there some good way to organize these files better? I was considering to make some more packages but is there some "official" way to organinze java applications of

  • Help - I am unable to delete 2 folders from the trash in Mac OS X Lion

    Help - I am unable to delete two folders (one inside the other) and it seems to be playing havoc with my Finder. Can anyone advise on how I remove these? Thanks.

  • About Function modules

    In function module so many parameters are there i want to know the particular parameter purpose, how to know ? RKD_CLIENT_COPY_OBJECTS is FM, i want to know OBJECTTYPE parameter purpose and what data i give to that field.