Creating two rows from a single row information

Hi,
I have data that will always be returned as a single row from a join of tables t1, t2.
However I want the single row to be split into two rows. i.e First row containing some fields and second row containing th remaining fields.
I think there might be a thread already existing. Can you please point me in the right direction if it is.
select t1.c1, t1.c2, t2.c1, t2.c2
from t1, t2
where t1.c3 = t2.c3
I expect the output 2 rows like the following
t1.c1 t2.c1
t1.c2 t2.c2
Thanks

SQL>WITH t1 AS (SELECT     't1c1_' || ROWNUM AS c1, 't1c2_' || ROWNUM AS c2, ROWNUM AS c3
  2                    FROM DUAL
  3              CONNECT BY LEVEL <= 3),
  4       t2 AS (SELECT     't2c1_' || ROWNUM AS c1, 't2c2_' || ROWNUM AS c2, ROWNUM AS c3
  5                    FROM DUAL
  6              CONNECT BY LEVEL <= 3),
  7       t3 AS (SELECT t1.c1 AS c11, t1.c2 AS c12, t2.c1 AS c21, t2.c2 AS c22, ROWNUM AS r
  8                FROM t1, t2
  9               WHERE t1.c3 = t2.c3)
10  SELECT   a, b
11      FROM (SELECT c11 AS a, c21 AS b, r, 1 AS s
12              FROM t3
13            UNION ALL
14            SELECT c12, c22, r, 2 AS s
15              FROM t3)
16  ORDER BY r, s;
A                                             B
t1c1_1                                        t2c1_1
t1c2_1                                        t2c2_1
t1c1_2                                        t2c1_2
t1c2_2                                        t2c2_2
t1c1_3                                        t2c1_3
t1c2_3                                        t2c2_3Urs

Similar Messages

  • What is the prerequisite for creating two hierarchies from one fact table i

    Hi,
    what is the prerequisite for creating two hierarchies from one a single fact table.
    Rgds,
    Amit

    create global temporary table t1 as select * from trn_ordbase on commit preserve rows;You CANNOT use this syntax.
    http://download-east.oracle.com/docs/cd/B19188_01/doc/B15917/sqcmd.htm
    http://download-east.oracle.com/docs/cd/B19188_01/doc/B15917/glob_tab.gif
    http://download-east.oracle.com/docs/cd/B19188_01/doc/B15917/cre_tabl.gif

  • Creating vecor art from a single form field.

    How do I create vector art from a single form field within a pdf that has serveral form fields in it?
    Thanks
    Chris

    I need to create vector art from text within one form field on a page with several form fields on it.
    1- single form field
    2- create vector art from text within the single form field mentioned above
    3- if possible export to a file
    4- if not possible how can I create vector art from a pdf automatically?
    5- if possible, create a button that will allow users to create vector art from text in a single form field
    Thank you,
    Chris

  • Updating two table from a single query

    I have two table such as
    user_log(user_id , password)
    and
    user_info(user_id , name , age , address , sex , email , contact)
    If I want to add data from a single form in php then what is the query?

    Hi,
    welcome to the forum..! plesae always post table data and expected result to help forum members help you better.
    From what I understand, all you need is a join on userid (assuming userid is unique/primary key )
    select ul.userid,
             ul.password,
            ui.name,
            ui.age
      from user_log ul,
              user_info ui
      where ul.user_id = ui.user_id
        ---- and any otehr condition for the user that you need.(where clause)In PHP......(based on this link.. http://wiki.oracle.com/page/PHP+Oracle+FAQ
    haven't tested the code.. )
    <?php
    $conn = oci_connect("scott", "tiger", "localhost/XE");
    if (!$conn) {
    $m = oci_error();
    echo $m["message"];
    exit;
    $stid = oci_parse($conn, "select ul.userid,
             ul.password,
            ui.name,
            ui.age
      from user_log ul,
              user_info ui
      where ul.user_id = ui.user_id");
    oci_execute($stid);
    // Query the table
    echo "<table border='1'>";
    while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
    echo "<tr>";
    foreach ($row as $item) {
    echo "<td>".($item!==null?htmlentities($item):" ")."</td>";
    echo "</tr>".PHP_EOL;
    echo "</table>";
    oci_free_statement($stid);
    oci_close($conn);
    ?>Try to provide more details.. if this is not what you are looking for.
    Hope this helps,
    Rajesh.

  • CAN WE CREATE TWO WF ACCOUNT ON SINGLE DATABASE

    I have requirement to create two separate WF account for development and production. so can i create it on single database?
    i think again i need to run workflow configuration assistant with different name.
    but what should be TNS connect descriptor in this case? is it the same for previous account
    pls. suggest it's urgent
    regards,
    jakpun

    I am doing it already !!
    Thanks .
    Khan
    Check out http://www.aspirehr.com/dynamicforms/

  • How to make two tables from one single taable

    Hi,
    i have one table with 100 records and i want to create two tables each with 50 records and with no duplicates. if i will do on bases on empno then i have to check the min and max emp no and then divide them in two tables, is there any automate way of performing this task.
    Regards,
    Abida

    Hi,
    A rather quick and dirty solution, but definitely works.
    I used the HR sample schema (employees table) for this.
    hsaprd@706447>create table tab1 as select * from employees where rownum <51;
    Table created.
    hsaprd@706447>select count(*) from tab1;
    COUNT(*)
    50
    hsaprd@706447>create table tab2 as select * from employees where employee_id nnot in (select employee_id from tab1);
    Table created.
    hsaprd@706447>select count(*) from tab2;
    COUNT(*)
    56
    hsaprd@706447>
    Hope this helps!
    -Anand

  • Uprgrade to Cloud on two Macs from a single set of CS disks?

    We were running CS5 legally on two Macs (from one set of disks) and now want to upgrade to Creative Cloud on both computers. Does anyone know if Adobe will let us get the upgrade price for both? We only have one serial number.

    a single user license allows one user to install on up to two computers.
    to get upgrade pricing and to install cc you do not need to have a previous version installed.  having the previous version's serial number is sufficient.

  • RDMBS - Creates two rows in table and adds to "everyone" group

    I have got the RDBMSRealm (using the example code) working from a JSP and a new
    user is persisted to my Oracle 8i users table. From the WLS console I can also
    see this new user under my Group "Candidates". However it has also added this
    user to the "everyone" group and I have two identical rows in my table. I can't
    see where it picks up this "everyone" group. Any pointers would be appreciated.
    Thanks.
    I'm using WLS 6.1 sp2 under Windows 2K Prof.

    "Roger Lee" <[email protected]> wrote:
    >
    I have got the RDBMSRealm (using the example code) working from a JSP
    and a new
    user is persisted to my Oracle 8i users table. From the WLS console I
    can also
    see this new user under my Group "Candidates". However it has also added
    this
    user to the "everyone" group and I have two identical rows in my table.
    I can't
    see where it picks up this "everyone" group. Any pointers would be appreciated.
    Thanks.
    I'm using WLS 6.1 sp2 under Windows 2K Prof.

  • Is it possible to create a PDF from a single response?

    I can only export the entire table, but I would like to create an individula PDF based on the response of a single submittal.
    Is this fucntion available?  If so, where?

    Check out this FAQ: http://forums.adobe.com/docs/DOC-1383

  • How to create two String from ResultSet to arraylist?

    Hi,
    Here is my question:
    String sql = "select colA, colB from tblA";
    String str1 = null;
    String str2 = null;
    ArrayList al = null;
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery(sql);
    while(rs.next()){
              str1 = rs.getString("colA");
              str2 = rs.getString("colB");
    }May i know how can i set the str1 and str2 in the ArrayList al?
    Thanks.

    Hi,
    Here is my question:
    String sql = "select colA, colB from tblA";
    String str1 = null;
    String str2 = null;
    ArrayList al = null;
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery(sql);
    while(rs.next()){
    str1 = rs.getString("colA");
    str2 = rs.getString("colB");
    May i know how can i set the str1 and str2 in the
    ArrayList al?
    Thanks.
    is this what you're looking for?
    al = new ArrayList();
    al.add(str1);
    al.add(str2);

  • How do I create mutliple events from a single event?

    I have a large event clip which I want to divide into multiple smaller clips.
    The edit commands only seem to effect the clips in a project. In view of this I inserted the clip into a new project and then split the clip. However I cannot now transfer the new clips back into events.

    First set your importing option to encode as MP3 (I believe the default state is AAC). Then put in your CD. Now hit import and all the songs will be imported as MP3s into your iTunes library.
    If you want to see the actual files, then in the Finder, go to the Music folder then into the iTunes folder then into the iTunes Music folder where you will find folders by artist and inside those it goes by album.
    Patrick

  • Acrobat creates two IDs from Windows account

    I have 200+ users with Acrobat 8 Pro. We use a WebDAV server on our internal domain for reviewing and commenting on PDF files. 5-20 users review each PDF on average. Most users have PC laptops. In the office, they connect directly to our domain. Externally, they use a Cisco VPN client to gain access to internal resources.
    The issue that we are having is inconsistent, but has some pattern. Only a few users are affected. When a user logs in to the WebDAV server, they use a unique ID, a six-digit lowercase ID. When they are in the offices, they ID comes through on PDF comments as lowercase. When the troubled users are off-site with or without the VPN, their ID has uppercase characters. Think 'smitjo' internally vs 'SmitJo' externally.
    Wouldn't be a problem identifying the owner of the comments, but when a user is off-site they are not the owner of the comments that were made on-site anymore. The worst troubles have been that sending comments off-site will remove ALL comments made on-site. This can be a major problem, removing days worth of work in one click.
    I have introduced a few workarounds, like saving incremental copies locally as backups. Workarounds are not a viable option when working with this many users on as many PDF reviews as I have active currently.
    Anyone have any thoughts as to where the cause of my woes is or a possible solution?

    There is no list.  Deauthorizing and reauthorizing, will not acomplish anything, nor will it have any effect on your computer or your devices.
    If you have reached the limit of 5, then you can deauthorize all and the authorize the active computers.

  • XQuery for making two tags from a single tag

    Hi All,
    I am using OSB 11g. I am getting an XML like this:
    <DOC>
    <INFO>
    <ATTRIBUTE ID="name">
    <VALUE>ABCD</VALUE>
    </ATTRIBUTE>
    <!--Optional-->
    <ATTRIBUTE ID="date">
    <VALUE>
    29/09/09
    19/09/11
    </VALUE>
    </ATTRIBUTE>
    <!--Optional-->
    <ATTRIBUTE ID="accNo">
    <VALUE>823748923987</VALUE>
    </ATTRIBUTE>
    <!--Optional-->
    <ATTRIBUTE ID="address">
    <VALUE>XYZW</VALUE>
    </ATTRIBUTE>
    </INFO>
    </DOC>
    Only when ID="date", I want to change the ATTRIBUTE tag as
    <ATTRIBUTE ID="date">
    <VALUE>29/09/09</VALUE>
    <VALUE>19/09/11</VALUE>
    </ATTRIBUTE>
    Is there any XQuery to do this in OSB?
    Please help!!
    Thanks in advance!!
    Regards,
    Karthik

    Try this:-
    Assign [ <test>... ]
    <test> <value></value> <value></value> </test>
    to [ finalValueDate ]
    For Each [ attribute ] in [ ./*:DOC/*:INFO/... ]
    ./*:DOC/*:INFO/*:ATTRIBUTE
    of [ body ]
    Indexed by [ undefined Variable ] with total count in [ undefined Variable ]
    Do (
         If ([ $attribute/@ID ... ]
    $attribute/@ID = "date"
         then (      
    Assign [ fn:normalize-sp... ]
    fn:normalize-space($attribute/*:VALUE/text())
    to [ date ]
    Replace [ node contents ] of [ ./*[1] ]
    ./*[1]
    in [ finalValueDate ] with [ fn:substring($d... ]
    fn:substring($date, 1, 8)
    Replace [ node contents ] of [ ./*[2] ]
    ./*[2]
    in [ finalValueDate ] with [ fn:substring($d... ]
    fn:substring($date, 10, 8)
    Replace [ entire node ] of [ .//ATTRIBUTE[@ID="date"]]
    .//ATTRIBUTE[@ID="date"]
    in [ body ] with [ <ATTRIBUTE>... ]
    <ATTRIBUTE> <VALUE> {$finalValueDate/*[1]/text()}</VALUE> <VALUE> {$finalValueDate/*[2]/text()}</VALUE> </ATTRIBUTE>
    This worked for me. I got the following response:
         <DOC>
         <INFO>
         <ATTRIBUTE      ID="name">
         <VALUE>ABCD</VALUE>
         </ATTRIBUTE>
         <!--Optional-->
         <ATTRIBUTE>
         <VALUE>29/09/09</VALUE>
         <VALUE>19/09/11</VALUE>
         </ATTRIBUTE>
         <!--Optional-->
         <ATTRIBUTE      ID="accNo">
         <VALUE>823748923987</VALUE>
         </ATTRIBUTE>
         <!--Optional-->
         <ATTRIBUTE      ID="address">
         <VALUE>XYZW</VALUE>
         </ATTRIBUTE>
         </INFO>
         </DOC>

  • Two objects from one table

    My current setup is two tables and two objects with a one to one relationship between them, Object and ObjectMD (metadata).
    Not sure why my predecessors set it up like this but...that's how it is.
    The problem is that my Object table (and thus ObjectMD also) has reached 40 million rows and large joins between Object and ObjectMD are taking forever and are completely unnecessary.
    I want to import the ObjectMD data into the Object table and go forward with a single table. The problem is that the ObjectMD table has it's own java surrounding it and that code is used in way too many places to weed it out. I need to leave the Java object structure in place.
    I think I should be able to create both these objects from a single table, but I can not figure out the descriptor. My set method needs to be getMetaData().setMethod, but of course TL's reflection doesn't like this. I suppose I could create new methods in Object to get/set all these fields and just forward them to the real methods.
    How can I define descriptors to create two objects from a single table?

    What I decided on for my last problem was to use a method to setBar, and inside that method, set the Foo of the Bar.
    Here are my files for future reference:
    --------------------------------------Foo.java-------------------------------------
    public class Foo {
         public int id;
         public String first;
         public Bar bar;
         public void setBar(Bar newBar){
              if(newBar != null){
                   newBar.foo = this;
              this.bar = newBar;
    --------------------------------------Bar.java-------------------------------------
    public class Bar {
         public Foo foo;
         public String second;
    --------------------------------------Descriptors.java-------------------------------------
    public class Descriptors {
         public static void addDescriptors(Project project) {
    project.addDescriptor(Descriptors.buildFooDescriptor());
    project.addDescriptor(Descriptors.buildBarDescriptor());
    private static Descriptor buildFooDescriptor() {
    Descriptor descriptor = new Descriptor();
    //     basic information
    descriptor.setJavaClass(Foo.class);
    descriptor.addTableName("FOO");
    descriptor.setPrimaryKeyFieldName("ID");
    //     mappings
    DirectToFieldMapping directToFieldMapping;
    AggregateObjectMapping aggregateObjectMapping;
    //     id mapping
    directToFieldMapping = new DirectToFieldMapping();
    directToFieldMapping.setAttributeName("id");
    directToFieldMapping.setFieldName("ID");
    descriptor.addMapping(directToFieldMapping);
    //     first mapping
    directToFieldMapping = new DirectToFieldMapping();
    directToFieldMapping.setAttributeName("first");
    directToFieldMapping.setFieldName("FIRST");
    descriptor.addMapping(directToFieldMapping);
    //     bar mapping
    aggregateObjectMapping = new AggregateObjectMapping();
    aggregateObjectMapping.setAttributeName("bar");
    aggregateObjectMapping.setReferenceClass(Bar.class);
    aggregateObjectMapping.setSetMethodName("setBar");
    aggregateObjectMapping.dontAllowNull();
    descriptor.addMapping(aggregateObjectMapping);
    return descriptor;
    private static Descriptor buildBarDescriptor() {
    Descriptor descriptor = new Descriptor();
    // basic information
    descriptor.descriptorIsAggregate();
    descriptor.setJavaClass(Bar.class);
    //     mappings
    DirectToFieldMapping directToFieldMapping;
    //     second mapping
    directToFieldMapping = new DirectToFieldMapping();
    directToFieldMapping.setAttributeName("second");
    directToFieldMapping.setFieldName("SECOND");
    descriptor.addMapping(directToFieldMapping);
    return descriptor;
    ----------------------------------------Go.java------------------------------------
    public class Go {
         public static void main(String[] args) {
              if(args.length != 0){
                   throw new RuntimeException("Arguments are not supported");
              Project project = new Project();
              project.setName("fooBarProject");
              DatabaseLogin login = new DatabaseLogin();
         login.usePlatform(new Oracle9Platform());
         login.setDriverClassName("oracle.jdbc.driver.OracleDriver");
         login.setConnectionString("jdbc:oracle:thin:@nnn.nnn.nnn.nnn:nnnn:SERVICE");
         project.setDatasourceLogin(login);
         Descriptors.addDescriptors(project);
         Server server = project.createServerSession(2, 2);
         server.setLogLevel(oracle.toplink.sessions.SessionLog.FINE);
         server.login("schema", "password");
         Session session = server.acquireClientSession();
         UnitOfWork uow = session.acquireUnitOfWork();
         Foo fooBar = (Foo) uow.newInstance(Foo.class);
         fooBar.id = (int) (Math.random() * 10000);
         fooBar.first = "abcd";
         uow.commit();
         ExpressionBuilder builder = new ExpressionBuilder();
         Foo fooBarLoad = (Foo) session.readObject(Foo.class, builder.get("id").equal(fooBar.id));
         System.out.println("ID:" + fooBarLoad.id + " FIRST:" + fooBarLoad.first + " SECOND:" + fooBarLoad.bar.second );
         session.release();
         server.logout();
    ------------------------------------------------------------------------------------------

  • Display two rows at the same time

    Hi,
    How can I show on page two rows (same iterator) at the same time.
    I can create on page input attributes and than in backing bean create two rows for iterator when I inserting data.
    (or when showing data get two rows from iterator in backing bean and set value for input attributes)
    Is there another way?
    Andreja

    Both. To show and create.
    I'm using ADF Web Services and I call method with array parametar.
    User have to create two record using form (not table) and records must be visible at the same time.
    I'm calling method that return array with two records, too.
    I can show both record in table but I have to display them using form.
    Andreja

Maybe you are looking for

  • HT6154 I tried to update Iphone 4 to IOS7. It is now frozen on itunes with picture of itunes and connection cord. can't make or receive calls. Help

    I have tried to update y iPhone 4 with ios7 several times. The first time it did not update and erased all of my contacts. This time the screen went blank and is now stuck on a screen that has a picture of iTunes icon and a usb plug in. I cannot get

  • Issue with Logitech Bluetooth mouse

    Hi everyone! I have some problems in correctly configuring my Logitech v270 bluetooth mouse. I followed all the steps in http://wiki.archlinux.org/index.php/Bluetooth_Mouse, but I still can't connect automatically at startup. Each time I boot my lapt

  • IDoc....!!!

    < MODERATOR:  per the forum rules, please use an appropriate subject in your message.  message locked. > Hi.. I have got an Idoc issue for which posting period is closed.  But client dont want to change the PP.  Instead he wants to post it in current

  • BFC- Creating Package rule

    Hi I created a package rule for allocation.However when I run, the log shows that 1 row selected and no entries are posted.I expect the system to split the cost and post in respective accounts with different audit id. Please help, if anybody has set

  • Alert rule in alert configraution

    hi guruz, In alert configraution ,when we design the alert category for any scenerio. my question is that ,can we design the alert category without alert rule,or defining alert rule is compulsory for any alert category.? pls guide me warm regards.