Help needed in using Pivot by joining 2 tables

Hello everyone,
I am very new to usage of Pivot that includes joining 2 tables. Below is the scenario and request your help in this regard.
Table1
ID1  Description
1     Stationary
2     Apparel
3     Home Decor
Note : ID1 is unique
Table2
ID2     ID1       Item
1         1          Book
2         1          Paper-A4
3         2          T-Shirt
4         1          Pencil
5         3          Flower Vase
Note : ID2 is unique
I am trying to get the below result set.
ID2 Stationary   Apparel   Home Decor
1     Book          NULL         NULL
2     Paper-A4    NULL         NULL
3     NULL          T-Shirt      NULL
4     Pencil         NULL         NULL
5     NULL          NULL         Flower Vase
Please help in this regard.
Thanks in advance,
Kiran

Just guessing
SELECT id2,
CASE WHEN Description='Stationary'
THEN Item  END [Stationary],
CASE WHEN Description='Apparel'
THEN Item  END [Apparel],
CASE WHEN Description='Home
Decor' THEN Item  END [ Home
Decor]
FROM t1 JOIN t2 ON t1.id1=t2.id1
Best Regards,Uri Dimant SQL Server MVP,
http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Consulting:
Large scale of database and data cleansing
Remote DBA Services:
Improves MS SQL Database Performance
SQL Server Integration Services:
Business Intelligence

Similar Messages

  • Urgent help needed in Using German Umlauts for Table names

    I created a table with Umlauts But i am not able to select from
    this table.I am also not able to drop this table as i get
    invalid character error.What setting has to be set.The NLS is I
    believe GERMAN_GERMANY.WE8ISO8859P1

    Pl do not post duplicate threads - insert dont work in Workflow
    Srini

  • Help needed for using BASIC authentication through JDBCRealm

    Help needed.
    Hello,
    I am doing a degree project, so far it works fine in my local machine, I need to try it on my virtual hosting (as it is a live server).
    My project requires JDBCRealm, that is BASIC authentication loading access data from mysql database. Normally this setup can be done in Server.xml file, because my Tomcat hosting is a virtual one, I only have permission to access the web.xml file.
    My question is: is it possible to get it done in an alternative way? In web.xml? Some properties file maybe?
    Thank you very much.

    You can set this up for your context using META-INF/context.xml instead of working with server.xml.
    Make a directory called META-INF under your webapp ( it'll be at the same level as WEB-INF ). Under this, add a context.xml with all your context specific configuration including the realm. A sample is below
    <?xml version="1.0" encoding="UTF-8"?>
    <Context path="/myApp" reloadable="true">
        <Realm
            className="org.apache.catalina.realm.JDBCRealm"            
            driverName="com.microsoft.jdbc.sqlserver.SQLServerDriver"         
            connectionURL="jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=myDB;SelectMethod=Cursor;"
            connectionName="username" connectionPassword="password"
            digest="MD5" userTable="users" userNameCol="userid" userCredCol="userpassword"
            userRoleTable="user_roles" roleNameCol="rolename"
        />
    </Context>Hope this helps.
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    ----------------------------------------------------------------

  • Help needed in using the DocCheck utility

    Hi
    Can somebody help me to use the DocCheck utility.I need to check that all the java files have the required javadoc tags and they are correct.
    I have downloaded the zip file and I have been giving the following commands
    c:\javadoc -doclet com.sun.tools.doclets.doccheck.DocCheck -docletpath c:\svk\jdk1.2.2\bin\doccheck1.2b1\lib\doccheck.jar -sourcepath<full path with the file name>
    But I get the following error message : No package or class specified.
    I also tried giving the following command:
    D:\SegaSource\sega\src\com\sega\account>javadoc -doclet com.sun.tools.doclets.do
    ccheck.DocCheck -docletpath d:\jdk1.3\doccheck1.2b1\lib\doccheck.jar User.java
    But I get the following message:
    Loading source file User.java...
    Constructing Javadoc information...
    javadoc: warning - Import not found: com.sega.account.address.Address - ignoring
    javadoc: warning - Import not found: com.sega.account.icon.Icon - ignoring!
    javadoc: warning - Import not found: com.sega.common.DateUtil - ignoring!
    javadoc: warning - Import not found: atg.nucleus.GenericService - ignoring!
    javadoc: warning - Cannot find class com.sega.account.icon.Icon
    javadoc: warning - Cannot find class com.sega.account.address.Address
    javadoc: warning - Cannot find class com.sega.account.MasterManager
    7 warnings
    please help
    Thanks
    SVK

    I have never ran the DocCheck from the command prompt, so I really don't know how to do it, but I do run it succesfully using ant (build tool from apache - jakarta, if you use tomcat you already have it installed).
    So.. if you do use ant.. this will help:
    <target name="doccheck" depends="prepare">
         <javadoc
              packagenames="${packages}"
                    destdir="${doccheck.home}"
              doclet="com.sun.tools.doclets.doccheck.DocCheck"
              docletpath="${doccheck.path}" >
              <classpath refid="project.classpath"/>
              <sourcepath refid="project.classpath"/>
         </javadoc>
    </target>If you don't use it.. I guess I was of no help, sorry.
    Ylan

  • Href and target tags tutorial/help needed for use with an existing website

    I have a website, (built through iweb), and an intro movie. I have spent a lot of time trying to understand the proper tags and how to use them without much luck. My goal is to have the homepage associated with my domain name load in a browser while at the same time have my intro movie open in a Quicktime Player window, play, and automatically close leaving the webpage visible. If anyone can point me to a tutorial or walk my through the process I would appreciate it.

    Poster movie style. Requires QuickTime Pro:
    Create an image (or a frame from your movie). This becomes the "poster". You could add text to it (Click to Play) in a graphic editor app to help your viewers or add text to the page under the image with these instructions.
    Save this new file as poster.mov
    It becomes the src="poster.mov" (source tag in the html code). Set its dimensions to fit your page layout.
    Your "intro movie" will be your href="intro.mov" (href tag in the html code).
    Open it with QuickTime Pro and then open the Movie Properties window. Click on the Presentation tab to see the choices. Automatically close option will close the QuickTime window. Automatically quit option will quit the running QuickTime Player app. This would be a better option as the browser should come back as the "front" application. You also want to check "auto play".
    Use Save As (preserves fast start feature) and name this file intro.mov
    In your html code for the QuickTime files you need to set target="quicktimeplayer" (this launches the QuickTime Player app instead of using the browser plug-in). It may also help if you use the full URL to both files in each tag (http://myserver.com/foldername/intro.mov).
    One of mine as an example. It uses automatically close window:
    http://homepage.mac.com/kkirkster/mycareerfuture/
    View the source code to see the tag structure. My page uses javascript instead of the older object/embed tag code.
    More useful links:
    http://developer.apple.com/internet/ieembedprep.html
    http://www.qtbridge.com/pageot/pageot.html

  • Help needed on using hardware tokens / Smart Cards for encryption

    I need help in filling the following gap in my understanding
    I know about
    1. Using keys in Java keystores to encrypt/decrypt data (Signing, symmetric encryption)
    2. Using Keytool to export a digital certificate to a keystore.
    I need help in knowing
    1. How the certificate stored in secret device is shared with java key stores. Do I need to use some special library.
    2. Is the process of encrypting Secret Key bytes defferent from wrapping the key?
    Specifically, I want to use iKey (USB based security hardware token) in my system, which says that it supports
    �� The PKCS#11 standard library
    �� The MSCAPI and CSP standard libraries
    �� Using automatic certificate registration

    > We have a current Server with 4 x 4 cores, 64 GB RAM, 6TB HDD, Windows 2K8 R2 and SQL Server 2K8 R2. On this server we have installed 6 SAP Servers(both ABAP and JAVA based). We want to install two more SAP servers on this machine but planning to use the Hyper-V Mode to ensure that there is no conflict. With this background here are my queries.
    You should not run SAP instances on the server with the hypervisor (the OS running on the metal). If you want to virtualize, then do it for all instances.
    Read
    Note 1246467 - Hyper-V Configuration Guideline
    Note 1570141 - Key Figures of Virtualization on Hyper-V
    > u2022             Is it possible to take a Image of existing installation (6 SAP Servers and SQL Server) that we have done?
    If they are running on the same OS you will always take images of everything.
    > I think this was possible in VMWare.
    So those 6 servers are virtualized already??
    > The issue I foresee is that in this image the servers are using Machine Name as host. In the Hyper V mode the host name will change. So how will this work?
    The safest way is to do a homogeneous system copy.
    > u2022             Can I run the normal windows mode along with Hyper V. Basically we want to keep our 6 SAP servers running and for the two new servers create two hyper V instances and allocate 2 cores and 4GB RAM each. Is this possible? Or as per Microsoft on the root we should not run any server?
    According to
    Note 1246467 - Hyper-V Configuration Guideline
    this should not be done.
    Markus

  • ICan't ReInstall my computer  please help. need to use Mac for school next week

    I use my Mac for School and stuff happened.
    Long story short.
    1) I tried to reset my Mac Book Pro  computer and I did.( by pressing option key and go to disk utility and erase tab and erase)
    2) then I know I was supposed to go to Reinstall OS X Lion and I did but I quit. (took 10 hrs and plus my internet is bad and couldn't DL the other stuff)
    3) I remembered that I had a recovery disk. so I inserted it and I went to the disk utility, dragged the Macintosh HD to the restore tab, destination, and it copied my recovery disk data? to my Machintosh HD and the name of it changed to Mac OS X Base System ( the name of my recovery disk)
    4) and I tried to restart, shut down my computer, it sends me to the same Mac OS Utilities. Again.
    5) so I went to Reinstall Mac OS Lion, agreed, and the download destination usually should be the Macintosh HD ( for me its Mac OS X Base System right now) but it said it is locked (because I'm dumb) and i can't install it now.
    6) i don't know what to do now because this is not my computer that I'm sending this support from. and I can't use my original Mac Book. what should I do?
    AND I NEED TO USE THE MAC NEXT WEEK FOR SCHOOL.
    more info: MacBook Pro 13 inch Late 2011 ( got it for christmas)
    OS 10.7.5 ( recovery disk is 10.7.2)
    had no problems for 2 years.
    Why is Internet bad? Japan. thats why.
    For those who wonder why I wanted to reset/restore my MacBook Pro or, want to hear the long story:
    I play League of Legends, Steam, Osu! on my Mac and it took alot of capacity (or space).
    And League of Legends has thisthing called "Item sets" that when you save it, it doesnt save it in the client (or app),  it saves the "item sets" data in your computer (took alot of capacity/space)
    Not just that, and I had iPhoto but when i downloaded iLife to my mac, and after that, it said my iPhoto is damaged and it can't open.
    And summer ended, my parents said If I fail my 11th grade, they are going to kick me out so I told them I'm going to reset my Mac to factory settings and get a fresh start, well this happened.

    hi there! I got it back to work by buying the USB version of Mac OS X Lion 10.7
    and since my internet connections are kinda bad, I'm not able to download and update it to 10.7.5.
    but anyways I got it back to work.
    All I can say is I suggest you to buy the USB version of Mac OS X Lion 10.7 from amazon or apple store.

  • Help needed in using the appropriate Trigger

    I have a master detail form.DEPT block is the master block and Employee is Detail block.I need to display the message when user is
    trying to enter the ENAME field in the Employee block(detail) when the DEPTNO in the DEPT block(master) is not equal to 10.
    Messgae should be displayed when user trying to type the value but not when the user navigates into the ENAME text field.
    What is the appropriate trigger that is useful here?
    Thanks.
    GSR

    If the DEPT block is table based in the block's POST-QUERY trigger you can simply set
      if :DEPT.DEPTNO !=10 then
        set_item_proerty('DEPT.ENAME', insert_allowed, property_false);
        set_item_proerty('DEPT.ENAME', update_allowed, property_false);
      else
        set_item_proerty('DEPT.ENAME', insert_allowed, property_true);
        set_item_proerty('DEPT.ENAME', update_allowed, property_true);
      end if;if the block is a non-database one then you can put that code in EMPNAME's WHEN-VALIDATE-ITEM trigger
    Luca
    Don't forget to mark the answer as helpful/correct if it is. please.

  • Help needed on retreving QID from APQI table

    Hi Gurus,
    I am using RBIBGL00 standard batch program in my report to create a batch session and in turn execute it.
    Batch session is getting created and it is getting executed as well.
    Issue:
    Now i need to retreive the batch information (succes/failure msgs) from the log
    so i am writing code as:
    select QID to display session log
    SELECT SINGLE qid                             
        INTO gv_qid
        FROM apqi
        WHERE datatyp = gc_bdc
          AND groupid = p_group    
          AND progid  = sy-repid     
          AND userid  = sy-uname
          AND credate = sy-datum.
    But qid is not getting fetched.
    Please help me to resolve this issue.
    Regards'
    Madan.

    Hi Thomas,
    I am using RFBIBL00 program in my report in 2 modes,
    to Create Batch session and
    in Call Transaction mode as well. ( is my requirement)
    1. In Call Transaction mode, i am passing the option xlog, so that after documents are loaded, a log is displayed.
    2. In Batch Session mode, batch is getting created and to execute that batch, i am calling another program RSBDCSUB.
    Batch is getting executed and result gets exported to memory.
    I am fetching the results from memory using function module
    "LIST_FROM_MEMORY"
    Then converting that to ASCI fromat using function module
    "LIST_TO_ASCI"
    Now i need to display the session log
    so i am retreving session data (QID) from APQI table.
    Please let me know if there are any alternatives.
    Thanks for your time and help.
    Regards'
    Madan.

  • Help needed to merge values from two tables -

    We have these three test tables shown, which have a common ID; And amount fields; I want the -------
    test1.val = test2.val + test3.val
    when they have common ids in them;
    I have shown the test data below: And the expected output;
    NOTE: In database with real table values - each of them have millions of rows in them. So effeciency is very important here;
    SQL> desc test1;
    Name Null? Type
    ID NUMBER
    VAL NUMBER
    SQL> desc test2;
    Name Null? Type
    ID NUMBER
    VAL NUMBER
    SQL> desc test3;
    Name Null? Type
    ID NUMBER
    VAL NUMBER
    SQL> select * from test1;
    ID VAL
    1 50
    2 50
    3 55
    4 60
    5 20
    5 rows selected.
    SQL> select * from test2;
    ID VAL
    1 25
    1 25
    2 5
    2 5
    4 75
    5 rows selected.
    SQL> select * from test3;
    ID VAL
    1 25
    1 25
    2 5
    2 25
    2 25
    5 10
    6 rows selected.
    I EXPECT the output to be:
    SQL> select * from test1;
    ID VAL
    1 100
    2 65
    3 20
    4 75
    3 20
    5 10
    6 rows selected.

    Need help with the update queries - joining three tables -

  • Help needed in using oracle rules SDK

    Hi,
    For testing my rulesets using oracle rules SDK I doing the following:
    1. Creation of dictionary, ruleSet.
    2. Declared two kinds of globalVariable variables in my datamodel :
    Final and non-Final.(Type of these varaibles are String and Double only)
    3. Final globalVaraibles are used in creating rule's patterns.
    4. Non-Final globalVariables are used in creating rule's action.
    5. Functions are created for asserting globalVariables values and
    returning non-final varaibles, since those are required as action
    results.
    6. In java code I am testing my ruleset (dict.testRuleSet()). Before
    testing i am populating my final global variables (since these are used
    in rule's patterns),
    and updating datamodel.
    The above procedure is working fine and I rules are successfully working.
    Now, first of all i want to know if the above mentioned approach is correct or it needs to be reframed??
    secondly, when i update datamodel with values (in java code itself) it
    takes 4-5 seconds in updating it. This is the main issue that why it is
    taking this much time??
    any comment would be of great help.
    Thanks in advance.

    I will send up an alert for you, Colin. Even though I use iTunes for Mac, troubleshooting it isn't my forté.

  • Help needed in  extracting data from PCD tables

    Hi Friends
    I Have a requiremnt for creating custom portal activity report ,even though
    we have  standard report, the extraced data will be used to create bw reports later.
    my part is to find a way to extract the data from PCD tables for creating
    custom portal activity reports
    i have selected the following  tables for the data extraction
    WCR_USERSTAT,WCR_WEBCONTENTSTAT,WCR_USERFIRSTLOGON,
    WCR_USERPAGEUSAGE.
    My questions are
    1.Did i select the Exact PCD tables?
    2.Can i use UME api  for  accessing the data from those tables?
    3.can i use  the data extracted  from PCD tables in JSPdynpage  or
    webdynpro apps?
    4.can i Querry  the  PCD tables from  JSPDynpage or Webdynpro
    Please help me in finding a solution for this
    Thanks
    Ashok Battula

    Hi daniel
    Can u tell  me weather i can develop the following  custom reports from those WCR tables
         Report Type
    1     Logins
          - Unique Count
          - Total Count
          - Most Active Users (by Partner Name)
          - Most Active Users (by Contact Name)
          - Entry Point (by page name)
          - Session Time
          - Hourly Traffic Analysis
    2     Login Failures
          - Total Count
          - Count by error message
          - Credentials Entered (by user name and password)
    3     Content Views (by File Name)
          - Unique Count
          - Total Count
          - Most requested Files
          - Most requested Pages
          - File Not Found
    4     Downloads (by File Name)
          - Unique Count
          - Total Count
          - Most requested Files
          - File Not Found
    5     Portal Administration
          - Site Content (by file name)
          - Site Content (by page name)
          - Latest Content (by file name)
          - Expired Content (by file name)
          - Subscriptions Count (by file name)
    6     Login History (by Partner, Contact Name)
          - No Login
          - First Login
          - Duration between registration and first login
          - Most Recent Login
          - Average Number of Logins
    plz  help me in find ing a way
    thanks
    ashok

  • Addon not starting - help needed in using ExtensionPackage tool

    Hi,
    I have deployed my addon using Lightweight Deployment in 9.1 PL00.
    When starting my addon, I get the error: SapProject1 has stopped working.
    What may be the issue?
    I packaged my addon using ExtensionPackage tool. In the SBO compatibility tab, we need to give the  version like 910.000.00. How should I check I my exact version number? In SAP application->Help->About SAP Business One, it shows version as 9.10.105, but in ExtensionPackage tool, I am supposed to write as nnn.nnn.nn. So how should I mention there?
    Secondly, in the Register 32-Bit Microsoft COM DLLs tab, should I select the DLLs: Interop.SAPbobsCOM.dll and Interop.SAPbouiCOM.dll ?
    Please guide me. I am trying to do it for first time.
    Thanks.

    I have never ran the DocCheck from the command prompt, so I really don't know how to do it, but I do run it succesfully using ant (build tool from apache - jakarta, if you use tomcat you already have it installed).
    So.. if you do use ant.. this will help:
    <target name="doccheck" depends="prepare">
         <javadoc
              packagenames="${packages}"
                    destdir="${doccheck.home}"
              doclet="com.sun.tools.doclets.doccheck.DocCheck"
              docletpath="${doccheck.path}" >
              <classpath refid="project.classpath"/>
              <sourcepath refid="project.classpath"/>
         </javadoc>
    </target>If you don't use it.. I guess I was of no help, sorry.
    Ylan

  • Desperate Help needed in using LabVIEW

    Hi,
    I'm a beginner in using LabView programming. Can anybody help with implementing Labview 6 and Keithley 2400 SourceMeter for data aquisition? I've wired up the hardware and have problem coming up with the software.. Any idea how to get started?

    Hello giam,
    I made wrapper vi's for the standard GPIB Read/Write functions to
    handle errors (using green icons to distinguish them better). The "send
    mult" handles simple strings (like standard GPIB Write) and array of
    strings (you often need to send more than one string to a device). But
    generally those icons have the same main functionality like standard
    GPIB...
    To send an array of strings you put the GPIB Write into a for loop and
    connect the array as input with autoindexing enabled (as standard).
    Maybe a small delay will help for some devices, the K2400 should do
    without.
    Edited: The greenish delay icon is just a standard "Wait ms" with
    additional error cluster in/out to allow dataflow programming...
    Message Edited by GerdW on 12-20-2005 09:25 AM
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome
    Attachments:
    GPIB_SendMult.png ‏10 KB

  • Help needed to use USB 9481 relay device

    I am new to LabVIEW so any help would be appreciated.
    I am attempting to start and stop an instrument with the USB-9481 relay device. On my instrument, connecting pins 1 and 2 will start the machine, and connecting pins 4 and 5 will stop the machine. How do I program LabVIEW to connect pins 1 and 2, wait a determined time, disconnect the connection, and then connect pins 4 and 5? No power needs to be supplied since the 12V is already being supplied by pins 2 and 4.
    Thanks so much.

    Hi Josh, No problem.  I took a look in the NI 9481 Operating Instructions and found this information to be quite useful:
    As far as the DAQ Assistant goes, you can only have 1 DAQ Assistant per device, so you will need to add channels to the DAQ Assistant by pressing the '+' button near the top left (just below the Play button). This device is pretty simple, and I'm sure you'll be using it in no time.
    Message Edited by Otis [DE] on 05-03-2006 03:20 PM
    Otis
    Training and Certification
    Product Support Engineer
    National Instruments
    Attachments:
    9481-Instructions.JPG ‏83 KB

Maybe you are looking for

  • Error in running a order import concurrent program

    Hi, Please tell me what type of error is this ,i am using user 'operations',and i have inserted data to the interface table successfully but while running the concurrent program ,i am getting this error. Cause: FDPSTP failed due to ORA-20100: File o0

  • Error in Creating Project in ESS.

    Hi All, I have a requirement where in , there is change in the personal data screen of ESS package. We configured the NWDI server. But when i am trying to extract the ess/in/pdata dc from the ESS SC. It is failing during the project Build and throwin

  • Changing update mode in Error DTP

    Hi Gurus, I have some issues with data in PSA. I am trying to solve it using Error DTP. While Executing DTP one record failed to load giving bad request. Now i created an error DTP. By default the extraction mode is Delta. DTP extraction Mode->Full E

  • OC4J 9.0.4 migrate to 10.1.3.1 JSP fails using abstract class for ResultSet

    Consider the following JSP code snipet: <% com.class.SQLDataSource detail = ((com.class.SQLDataSource)request.getAttribute("AcctList")); %> <%while detail.next()) {detail.getRow();%> <tr ...> <td ...><%= detail.getString("ACCT") %></td> </tr> <%}%> b

  • Group sort using 2 fields

    Is there any way that I can have two fields as a group sort in order that the first group sort field will repeat when the second field changes? Thanks. Leah