The results are thro 3 tables

Hi all

Following query works as expected
with explan as (
             select 'A' step,'aaa' des from dual union all
             select 'B' step,'bbb' des from dual union all
             select 'C' step,'ccc' des from dual union all
             select 'D' step,'ddd' des from dual
             ),
dependency as (
             select 'A' ID,'C' chil_d, 'A'paren_t  from dual union all
             select 'C' ID,'B' chil_d, 'C'paren_t from dual union all
             select 'D' ID,'A' chil_d, 'D'paren_t from dual
             )
 
SELECT       COALESCE (d.id, p.step, c.step)     AS step_out
,       c.des                                AS child
,       p.des                         AS parent
FROM             explan          p
LEFT OUTER JOIN      dependency  d  ON   d.paren_t  = p.step
LEFT OUTER JOIN      explan          c     ON   d.chil_d     = c.step
ORDER BY  step_out
;

 
Results
----------
S CHI PAR
- --- ---
A ccc aaa
B     bbb
C bbb ccc
D aaa ddd
If the extra table is there to get the description below

with ex_plan as (
             select 'A' step,'a1' des from dual union all
             select 'B' step,'b1' des from dual union all
             select 'C' step,'c1' des from dual union all
             select 'D' step,'d1' des from dual
             ),
ex_plan_des as (
             select 'a1' eid,'aaa' des from dual union all
             select 'b1' eid,'bbb' des from dual union all
             select 'c1' eid,'ccc' des from dual union all
             select 'd1' eid,'ddd' des from dual
             ),
dependency as (
             select 'A' ID,'C' chil_d, 'A'paren_t  from dual union all
             select 'C' ID,'B' chil_d, 'C'paren_t from dual union all
             select 'D' ID,'A' chil_d, 'D'paren_t from dual
             )
How does question the changes with the introduction of ex_plan_des tabl. Expected results should be the same


See you soon

Sexy

The easiest option is probably to join the tables ex_plan and ex_plan_des to return to the result you were using previously

SQL> ed
Wrote file afiedt.buf

  1  with ex_plan as (
  2               select 'A' step,'a1' des_id from dual union all
  3               select 'B' step,'b1' des_id from dual union all
  4               select 'C' step,'c1' des_id from dual union all
  5               select 'D' step,'d1' des_id from dual
  6               ),
  7  ex_plan_des as (
  8               select 'a1' eid,'aaa' des from dual union all
  9               select 'b1' eid,'bbb' des from dual union all
 10               select 'c1' eid,'ccc' des from dual union all
 11               select 'd1' eid,'ddd' des from dual
 12               ),
 13  dependency as (
 14               select 'A' ID,'C' chil_d, 'A'paren_t  from dual union all
 15               select 'C' ID,'B' chil_d, 'C'paren_t from dual union all
 16               select 'D' ID,'A' chil_d, 'D'paren_t from dual
 17               ),
 18  explan2 as (
 19               select a.step,
 20                      b.des
 21                 from ex_plan a
 22                      join ex_plan_des b
 23                        on (a.des_id = b.eid)
 24             )
 25  SELECT       COALESCE (d.id, p.step, c.step)       AS step_out
 26  ,    c.des                                 AS child
 27  ,    p.des                                 AS parent
 28  FROM                explan2     p
 29  LEFT OUTER JOIN     dependency  d  ON   d.paren_t  = p.step
 30  LEFT OUTER JOIN     explan2     c  ON   d.chil_d   = c.step
 31* ORDER BY  step_out
SQL> /

S CHI PAR
- --- ---
A ccc aaa
B     bbb
C bbb ccc
D aaa ddd

Justin

Tags: Database

Similar Questions

  • Why all the results are duplicated when searching in my bookmarks library?

    If I search for "Shell", for example, and then click on the 'name' column, most of the 'results' are duplicated. For example, "Perdido | On Shell"in the"shell"folder Parent is shown twice... same URL and al. I see that the or after the 01/02/2013 added bookmarks are NOT duplicated.

    In my case, the bookmarks ARE actually duplicated. I checked by exporting and by analyzing the HTML code.
    The whole "All bookmarks" hierarchy had somehow been copied into a random location of my favorite tree. This is why all bookmarks except most recent lie twice.
    It looked like this:

    - All Bookmarks
      + Bookmarks Toolbar
      + Bookmarks Menu
         + MY_FOLDER_A
         + MY_FOLDER_B
         - MY_FOLDER_C
           MY_NESTED_FOLDER_A
             - All Bookmarks
                .... older state fully duplicated!!!
    

    I deleted the nested copy of "All bookmarks" and it seems OK now.
    I made this copy by mistake (which I highly doubt) or a bug caused.

    Good to hear that you are not using Firefox Sync (I use it). It would have been a Prime Minister candidate for causing a problem like this. (My bad favorites have been replicated to all of the computers connected with synchronization).

    The copy of "All bookmarks" should have been made over the past months, but I couldn't determine exactly when. The copies have the same ADD_DATE and LAST_MODIFIED timestamp in the HTML file.

  • How to restore the size of the screen of search results? The place of departure of research is fine, but the results are so tiny that I can't read. Thank you.

    After the firefox search page appears and I launched a search, the results are back in very small print. If I have something to randomly select the page that opens is fine. The problem is only with the search results page.

    See this:
    https://support.Mozilla.com/en-us/KB/page+zoom

  • Change the color of the content area of a table

    Is there a way to change the color of the content area of a table? I want to set the table to be transparent, but I don't know how to do this.

    I'm not exactly clear on what you're trying to reach. However, I tried to adjust the table to transparent body with the Brush tool, and it's not enough. Then I did the following:

    (1) emphasize the table (i.e., border of crawling ants)

    (2) in the menu bar, select Edition > control to customize...

    (3) in the new window pop up, go to the menu bar and click on the key icon to make a pair of tweezers.

    (4) pull out control and use the Brush tool to make the body of the table and below transparent location plan.

    (5) save it as you see fit, as the Type Def or Strict Type def.

    A gross example is attached.

  • When I use the function "cut", the line of results more sharpness compared to the original files. For example, {A: "file.psd"-> cultures 4x6inch, 300 dpi-> B: "cropped file.psd} then the results are as described as a first step. What s the problem.

    When I use the function "cut", the line of results more sharpness compared to the original files. For example, {A: "file.psd"-> cultures 4x6inch, 300 dpi-> B: "cropped file.psd} then the results are as described as a first step. What s the problem. (Photoshop CC, windows7)

    I'm a Retoucher of photpfile have used the CS2 version for many years, and fuction 'Harvest' is an important and frequent tree tools myself. The result of the broke lines drive me annoying cause my feeling touch Sofete are all blown away. Please help me.

    I think you're talking about using the crop tool? If you're cropping with a size and resolution that involves interpolation of the image, the crop tool will use your preference for the Interpolation of the Image. By default, bicubic is automatic, which can easily result in a sharp file. Change your preference (in general) to bicubic and you shouldn't see any sharpening.

    I hope it works for your situation.

  • How to: 8315793 - keyboard use to reduce the results area

    Hello

    I saw the request for implementation: "8315793 - keyboard use to reduce the results area" in section 2.1.1 but I can't find even in the list of shortcut keys.

    What is the keyboard shortcut for this...?

    Thanks, Jürgen

    See request "Hotkey to show/hide the grid result" = How has been implemented 2.1.1?

    Have fun
    K.

  • After you generate a table in xml format, how can I save the result in an XML table?

    Hi all
    I used this feature to create a table in the XML schema:
    example:
    SELECT xmlelement ("State", xmlattributes (http://www.opengis.net/gml as "xmlns:gml"),)
    XMLFOREST (name as "Name", "Population" of the population)) of the State;
    result:
    < Statexmlns:gml = "http://www.opengis.net/gml" >
    < name > Wilkopolska < / name >
    the population of 35000 <>< / Population >
    < / state >
    Now I need to insert the result in an XML table, because I need to save the result to use the latter, I hope someone can help, and if there is other way to do this, it would be great.
    Thanks an ot and best regards,
    Lama.

    Just insert in a table...

    insert into t
    SELECT xmlelement("State", xmlattributes( 'http://www.opengis.net/gml' as "xmlns:gml"),
    xmlforest(name as "Name", population as "Population")) from state; 
    

    and a complete example:

    SQL> create table t (test xmltype)
      2  /
    
    Table created.
    
    SQL>
    SQL> create table state
      2  (name varchar2(10)
      3  ,population number
      4  )
      5  /
    
    Table created.
    
    SQL>
    SQL> insert into state values ('WI', 35000)
      2  /
    
    1 row created.
    
    SQL>
    SQL> SELECT xmlelement("State", xmlattributes( 'http://www.opengis.net/gml' as "xmlns:gml"),
      2  xmlforest(name as "Name", population as "Population")) from state; 
    
    XMLELEMENT("STATE",XMLATTRIBUTES('HTTP://WWW.OPENGIS.NET/GML'AS"XMLNS:GML"),XMLFOREST(NAMEAS"NAME",P
    ----------------------------------------------------------------------------------------------------
    WI35000
    SQL>
    SQL> insert into t
      2  SELECT xmlelement("State", xmlattributes( 'http://www.opengis.net/gml' as "xmlns:gml"),
      3  xmlforest(name as "Name", population as "Population")) from state; 
    
    1 row created.
    
    SQL> select *
      2    from t
      3  /
    
    TEST
    ----------------------------------------------------------------------------------------------------
    WI35000
    
  • Creating a loop in which the results are listing to specific columns

    Hello

    I am creating a loop for my data of three columns after being calculated will be converted into three columns again, and then run through text files separated 10 data to add to the new file so that when the loop is complete I have 3 columns with the data of all the 10 files. I.E. I have three data points A, B, C of file 1 in the column 0,1,2 and then when I run the file 2, three new data points 2A, 2B, 2 c will go under their respective column. Right now it's just clear the permeable trial. Any help would be appreciated, I am very familiar with loops and I'm just getting started

    If the files are named like that you have joined here:

    Use a shift register to keep a number stored between iterations.  Increment at each iteration.

    Decimal string turns into a string.  Concatenate strings allows you to add the path of file for each iteration.

  • I followed the instructions to import my cookies, Favorites, etc. of the IE 8. The results are only about half of my favorites are imported.

    I followed the instructions in the initial Setup. When I add favorites by copying since IE8 on firefox, it is said that they have been added, but when I look in the folder where they were placed, they aren't there. How can I "fix" this problem? Thanks in advance for your prompt response.

    If you have problems with importing IE bookmarks in Firefox, then export favorites in Internet Explorer to a HTML file and import this file in the Firefox Bookmarks Manager.

    If you don't have the menu bar in Internet Explorer, and then right-click on the toolbar above to activate the menu bar.

    • Export Favorites in Internet Explorer to a file (bookmarks.html) HTML:
      File > import and export
    • Import HTML file in Firefox:
      Bookmarks > show all bookmarks > import and backup > import bookmarks HTML

    See "Import from another browser" and "import from file":

  • When I copy and paste, the results are stripped of formatting.

    It's weird, I can copy and paste, but all pasting is wiped clean of formatting, underlying formulas (in Excel), hyperlinks, etc.  This happens in all programs (Word, Excel, gmail) and when the copy/paste between programs (Word to gmail).
    It must be a global setting of XP SP3.  I tried to roll back the computer a week, but the problem exists (not sure when it started).
    Any ideas?
    Thank you

    When you paste that you get a symbol down at the bottom that gives you paste options and select keep source formatting?

    http://www.excelforum.com/Excel-General/764099-copy-paste-losing-formatting.html

    This link mentions him "style" of excel, find out what the problem described is the same as yours. "

    http://help.WUGNET.com/office/copying-tab-loses-formattingftopic-1165433-DAYS0-orderasc-8.html

    This link mentions him ' theme'of the spreadsheet. "

    http://www.howtogeek.com/HOWTO/28478/copy-and-paste-in-Outlook-without-messing-up-your-formatting/

    He mentions how to keep the updated source in the form an email

    http://answers.Microsoft.com/en-us/Office/Forum/Excel

    Finally, if none of the help above, it is the link to the forum office.

  • How to compare data from the two table column by column and connect the result compared to the separate table

    Hello experts...

    I'm new to this forum and Oracle coding complex.

    I have a task in which I want to compare two tables with the same structure, same columns. My Oracle database is 11g Release 2. I want this column-by-column comparison and save the result in a separate table. (say result_table)

    The structure of the table would be as follows:

    SQL > desc emp;

    Name                                      Null?    Type

    ----------------------------------------- -------- ----------------------------

    EMPNO NOT NULL NUMBER 4

    ENAME VARCHAR2 (10)

    JOB                                                VARCHAR2(9)

    MGR                                                NUMBER(4)

    HIREDATE DATE

    SAL                                                NUMBER(7,2)

    COMM                                               NUMBER(7,2)

    DEPTNO NUMBER (2)

    SQL > emp_comp desc;

    Name                                      Null?    Type

    ----------------------------------------- -------- ----------------------------

    EMPNO NOT NULL NUMBER 4

    ENAME VARCHAR2 (10)

    JOB                                                VARCHAR2(9)

    MGR                                                NUMBER(4)

    HIREDATE DATE

    SAL                                                NUMBER(7,2)

    COMM                                               NUMBER(7,2)

    DEPTNO NUMBER (2)

    Both of the tables EMPNO is the primary key.

    I want to compare these two tables based on the EMPNO (EMPNO even is both tables).

    The result log table would be as follows:

    SQL > create table result_table

    2 (check_sr_no, number (5),)

    table_name 3 varchar2 (30),

    ROW_ID 4 varchar2 (20).

    column_name 5 varchar2 (20).

    6 column_data varchar2 (1000).

    compared_by 7 varchar2 (10));

    Table created.

    SQL > alter table result_table

    2 Add the constraint result_table_pk

    3 primary key (check_sr_no);

    Modified table.

    The name of the table and the name of the column will not be hardcoded (based parameter by user)

    I tried to use the dbms_comparison package, but do not find comparison of column to column.

    I also used by using the query operator LESS. It's showing the difference in rank.

    I also went to https://asktom.oracle.com/pls/apex/f?p=100:11:0:P11_QUESTION_ID:2151582681236

    Your help will be very appreciated.

    Thank you

    DK

    Tom Kyte has answered this question MANY times over the years. Here are links for its solution

    https://asktom.Oracle.com/pls/Apex/f?p=100:11:0:P11_QUESTION_ID:4934799800346640847

  • Product search results are not displayed in the correct style

    Could someone shed some light on why when I add the results in a web page the results are there, but they are not styled as they are in the shop?

    Simple patterns are in fashion catalogue 'boutique', your product list is

    (1) using the small_product.html model, and

    (2) very probably wrapped with

    And search results are:
    (1) possibly using the model of provision small_product_backup.html
    (2) very probably wrapped with a table or other markup

    Liam said, many reasons. Give us more details about your scenario.

  • How to display the results of the database from several tables in descending order?

    I have a key word to search for images on my website that allows visitors to search for specific things. My db msysql has 15 tables and for the search function I use a UNION ALL operation to join them any visitor can find all tables at the same time. The problem is that all the results are in ascending order. How can I get the results in descending order.

    SELECT *.

    FROM table1

    Keyword WHERE AS id LIKE %s or %s

    UNION ALL

    SELECT *.

    FROM table2

    Keyword WHERE AS id LIKE %s or %s

    UNION ALL

    SELECT *.

    TABLE 3

    Keyword WHERE AS id LIKE %s or %s

    PS

    I tried this and it doesn't work:

    SELECT * FROM table1 WHERE AS %s or id AS %s ORDER BY id DESC keyword

    and I know that this is not conventional to use SELECT * with so many tables, but believe me, I have my reasons. I'm not trying to do is to wrap the whole UNION within an external SELECTION

    Once more, the order by clause can only appear at the end of the last select statement in a UNION query. You have it on all select statements.

  • Include the results in "Batch report" instead of "report USE".

    Hi all

    I modified the ProcessSetup TS 4.0 reminder to perform a test of the preliminary material before testing 8 DUT using batch processing model. Since this is a reminder, the results are not registered by default, so I store it in a global table of results. Then I copy this table of results into my results MainSequence table.

    The problem is that this means that these preliminary results will be saved for UUT0 (if I use "A thread only" synchronization") or to the DUT (if I use the synchronization of batch processing model). How can I add my ProcessSetup test results to the "Results of the batch" section of the results page rather than the sections "USE results? The test checks the shared material and is thus applied to the DUT. I prefer not repeated it for each USE or make it look like, it applies only to WEAR it first.

    Thank you

    Chris

    Tomahawk,

    Al is correct that is whether you use HTML or ASCII report formats, you can override the ModifyReport... Reminders to get what you want. Unfortunately, with the XML declaration, you can use the ModifyReport... Reminders. In order to accomplish the functionality that you want to see everything and still use the report XML form, you will need to change the BatchReport reminder, as well as the XML style sheet you use.

    TestStand 4.2, we have created tutorials and provided better material for our XML Style sheets. With a little effort, I am convinced that with TestStand 4.2, you would be able to reach your goal.

    I suggest to take a look at customization of Style TestStand sheets of TestStand 4.2 help (available online). Unfortunately, Style XML TestStand 4.0 sheets do not have the same quality of literature as the TestStand 4.2 Style sheets, so you don't will not commented sections in the leaves of Style 4.0 as explained in the help.

    For this particular case, you do not want to change the reminder of BatchReport to store the data that you want to place in your report batch section. Then, you change the section batch report of the Style XML with XPath map appropriate to display these data in the batch report.

  • Dealing with the merged cells in a table

    Hello

    I use tables often enough in InDesign, and I always ran into the same problem with the scripts - dealing with merged cells

    The number of lines, I have a few cells which are merged horizontally

    As I go through the cells in my selection, I want to test the line with the contents of the first cell in the same row - that is, the key to the line

    In short, that's what I want to do:

    1. Select the cells (manually)

    2. run the script that checks each cell in the selection to test if it is in a line that begins with 'TOTAL' - and then, act accordingly

    My problem is that the results are never is correct because some lines have merged cells

    In turn, column 1 could have 50 lines, but column 2 can only have 48 rows (because it has 2 m)

    That is why, when I check the contents of the first row as such:

    cells[1].parentRow.cells[0].contents
    

    He was not a match - even if it's in the same line.

    What is the best way to get around this problem?

    If anyone can give help on this topic, I would be very appreicate it

    Thank you

    Davey

    Why do you need to know the index of line? Isn't parentRow get you the line concerned? I tried to recreate it but I don't see the problem. Maybe you can post some more of your code where exactly is the shift is not clear.

Maybe you are looking for