Connect query problem

Hello world

I stuck with a query. Let me explain the situation: I have a table I store the IDS of the logically equal records.

For example;
A = B
B = C
X = Y
Z = Y

My query must return all equivalent records. If you call the query with the parameter 'A', the result set must contain B and C. And if you call the query with the parameter 'Y', the result set contains X AND Z. I thought I can write the spiritual query using start with connect by statement. But the query does not work as I expected. Here's my code and sample data:



create table temptable (ID1, ID2 number); /

insert into a values (11,12) temptable; /
insert into a values (12,13) temptable; /
insert into a values (13,14) temptable; /
insert into a values (13,15) temptable; /



SELECT distinct from ID1
(
SELECT * FROM temptable
START WITH 13 = ID1 OR ID2 = 13
CONNECT TO NOCYCLE
(
(PREREQUISITE ID1 = ID1) OR
(PREREQUISITE ID1 = ID2) OR
(PREREQUISITE ID2 = ID1) OR
(PREREQUISITE ID2 = ID2))
) WHERE ID1 <>13
Union
SELECT distinct from ID2
(
SELECT * FROM temptable
START WITH 13 = ID1 OR ID2 = 13
CONNECT TO NOCYCLE
((PRÉALABLE ID1 = ID1) OR)
(PREREQUISITE ID1 = ID2) OR
(PREREQUISITE ID2 = ID1) OR
(PREREQUISITE ID2 = ID2))
) WHERE ID2 <>13


In my example, the definitions of equality;
11 = 12
12 = 13
13 = 14
13 = 15

When I call the query with parameters 13, I expect to get 11,12,14,15. But it returns only 12,14 and 15.

Thanks for any help or suggestion.
with t as (
            select  id1,
                    id2
              from  temptable
           union
            select  id2,
                    id1
              from  temptable
          )
select  distinct id2
  from  t
  where id2 != 13
  start with id1 = 13
  connect by nocycle id1 = prior id2
/

       ID2
----------
        11
        14
        12
        15

SQL> 

SY.

Tags: Database

Similar Questions

  • foreign key ALTER TABLE QUERY PROBLEM

    HAI ALL,

    ANY SUGGESTION PLEASE?

    UNDER: foreign key ALTER TABLE QUERY PROBLEM

    I want TO CREATE AND ALTER TABLE foreign key:

    1.TABLE:HAEMATOLOGY1
    COLUMN: HMTLY_PATIENT_NUM
    WITH
    TABLE: PATIENTS_MASTER1
    COLUMN: PATIENT_NUM (THIS IS THE KEY PRIMARY AND UNIQUE)

    1.TABLE:HAEMATOLOGY1
    COLUMN: HMTLY_TEST_NAME
    WITH
    TABLE: TESTS_MASTER1
    COLUMN: TEST_NAME ((C'EST LA CLÉ UNIQUE))
    ---------------


    SQL + QUERY DATA:
    -----------
    ALTER TABLE HAEMATOLOGY1
    Key constraint SYS_C002742_1 foreign (HMTLY_PATIENT_NUM)
    references PATIENTS_MASTER1 (PATIENT_NUM);

    ERROR on line 2:
    ORA-01735: invalid option of ALTER TABLE

    NOTE: THE NAME OF THE CONSTRAINTS: SYS_C002742_1 TAKEN FROM ORACLE ENTP TABLE DETAILS. MGR.
    ---------
    ALTER TABLE HAEMATOLOGY1
    Key constraint SYS_C002735_1 foreign (HMTLY_TEST_NAME)
    references TESTS_MASTER1 (TEST_NAME);

    ERROR on line 2:
    ORA-01735: invalid option of ALTER TABLE

    NOTE: THE NAME OF THE CONSTRAINTS: SYS_C002735_1 TAKEN FROM ORACLE ENTP TABLE DETAILS. MGR.

    ==============

    4 TABLES OF LABORATORY CLINIC FOR DATA ENTRY AND GET REPORT ONLY FOR THE TESTS CARRIED OUT FOR PARTICULAR

    PATIENT.

    TABLE1:PATIENTS_MASTER1
    COLUMNS: PATIENT_NUM, PATIENT_NAME,

    VALUES:
    PATIENT_NUM
    1
    2
    3
    4
    PATIENT_NAME
    BENAMER
    GIROT
    KKKK
    PPPP
    ---------------
    TABLE2:TESTS_MASTER1
    COLUMNS: TEST_NUM, TEST_NAME

    VALUES:
    TEST_NUM
    1
    2
    TEST_NAME
    HEMATOLOGY
    DIFFERENTIAL LEUKOCYTE COUNT
    -------------

    TABLE3:HAEMATOLOGY1
    COLUMNS:
    HMTLY_NUM, HMTLY_PATIENT_NUM, HMTLY_TEST_NAME, HMTLY_RBC_VALUE, HMTLY_RBC_NORMAL_VALUE

    VALUES:
    HMTLY_NUM
    1
    2
    HMTLY_PATIENT_NUM
    1
    3
    MTLY_TEST_NAME
    HEMATOLOGY
    HEMATOLOGY
    HMTLY_RBC_VALUE
    5
    4
    HMTLY_RBC_NORMAL_VALUE
    4.6 - 6.0
    4.6 - 6.0
    ------------

    TABLE4:DIFFERENTIAL_LEUCOCYTE_COUNT1
    COLUMNS: DLC_NUM, DLC_PATIENT_NUM, DLC_TEST_NAME, DLC_POLYMORPHS_VALUE, DLC_POLYMORPHS_

    NORMAL_VALUE,

    VALUES:
    DLC_NUM
    1
    2
    DLC_PATIENT_NUM
    2
    3
    DLC_TEST_NAME
    DIFFERENTIAL LEUKOCYTE COUNT
    DIFFERENTIAL LEUKOCYTE COUNT
    DLC_POLYMORPHS_VALUE
    42
    60
    DLC_POLYMORPHS_NORMAL_VALUE
    40-65
    40-65
    -----------------


    Thank you
    RCS
    E-mail:[email protected]
    --------

    ALTER TABLE HAEMATOLOGY1
    ADD Key constraint SYS_C002742_1 foreign (HMTLY_PATIENT_NUM)
    references PATIENTS_MASTER1 (PATIENT_NUM);

  • Printable report query problem

    I try to develop a printable report query. I created a report under shared components query which consists of 12 separate queries that collect data are all related to a single page element. The intention is to create a PDF document that is printed to the user on demand that will display all this information on the page element they have chosen.

    The query of the report gathers information and generates an XML file in the following format.
    <DOCUMENT>
        <ROWSET1>
            <ROWSET1_ROW>
                             *Data from query 1*
            </ROWSET1_ROW>
        </ROWSET1>  
        <ROWSET2>
            <ROWSET2_ROW>
                              *Data from query 2*
            </ROWSET2_ROW>
            <ROWSET2_ROW>
                              * Data from query 2*
            </ROWSET2_ROW>
       </ROWSET2>
       <ROWSET3>
           <ROWSET3_ROW>
                              * Data from query 3*
           </ROWSET3_ROW>
           <ROWSET3_ROW>
                              * Data from query 3*
           </ROWSET3_ROW>
       </ROWSET3>
    ......
    </DOCUMENT>
    Then, I took this XML file and developed a model RTF using Office BI Publisher and imported as a layout of the report.
    I then connected this provision of the RTF to the report query and he ran. I don't have all the data to print.

    I found the reason why that it did not work, it is that the XML file that is generated by the report query is not static. The following XML file that was generated by the report query looked like this:
    <DOCUMENT>
        <ROWSET1>
            <ROWSET1_ROW>
                               * Data from query 3*
            </ROWSET1_ROW>
            <ROWSET1_ROW>
                               * Data from query 3*
            </ROWSET1_ROW>
        </ROWSET1>  
        <ROWSET2>
            <ROWSET2_ROW>
                               * Data from query 7*
            </ROWSET2_ROW>
            <ROWSET2_ROW>
                               * Data from query 7*
            </ROWSET2_ROW>
            <ROWSET2_ROW>
                               * Data from query 7*
            </ROWSET2_ROW>
       </ROWSET2>
       <ROWSET3>
           <ROWSET3_ROW>
                               * Data from query 1*
           </ROWSET3_ROW>
       </ROWSET3>
    ......
    </DOCUMENT>
    So I can't develop a RTF model to display the data, if I do not know where these data will appear in the generated XML.

    Questions (I'll offer several POINTS to anyone who can answer all of these questions!)

    I use APEX version 3.1

    * 1. Why the report query seems randomly to renumber and reorganize the XML it produces? *

    * 2. Is it possible to make the report query to display the XML data in the order in which the individual queries are classified each time? *

    * 3. Is it possible to designate exactly the lines of sets of lines or lines supported by APEX? *

    * 4. Are there other methods can I Explorer to produce this report? *

    * 5. Is it a problem because I'm on an older version? Is it not a problem on 4.1? *

    Published by: bhenderson on February 1, 2012 08:22

    So, you have 12 separate petitions? No there is no way to join them in a union to build the required data set? Or even using views inline in a query for each set of values?

    Thank you

    Tony Miller
    Webster, TX

  • Insert query problem

    I have an insert query that I have not changed, but for some reason it won't insert anything in the database.

    The data is entered by a form of Ajax submission and goes to insert.php

    {if (isset($_POST['message_wall']))}
    / * The database connection * /.
    include ('config.php');

    / * Remove the HTML tag to prevent the injection of the query * /.
    $message = mysql_real_escape_string($_POST['message_wall']);
    $to = mysql_real_escape_string($_POST['profile_to']);

    $sql = "INSERT INTO wall (VALUES) (message)
    « '. $message. " »)';
    mysql_query ($SQL);

    I want to be able to add a user_id in the database too

    The ajax code:

    $(document) .ready (function () {}
    {$("form#submit_wall").submit (function ()}

    var message_wall is $('#message_wall').attr ('value');.

    $.ajax({)
    type: 'POST',
    URL: "insert.php"
    data: "message_wall ="+ message_wall, ".
    success: function() {}
    $("ul#wall").prepend ("< style li =' display: none" > "+ message_wall +"< /li > < br > < HR >");
    $("ul #wall li:first").fadeIn();)
    }
    });
    Returns false;
    });
    });

    Hello

    As it is a form ajax post then the form data should be inserted into your database using the insert.php script. All in the form of ajax jQuery is passed to the script of treatment if you process in the insert script it should work o/k.

    You must then include a text response to aid a statement simple echo in your insert script, this should include everything that you want to appear on your page.

    Php in your insert script would be similar to.

    At the beginning of the script.

    $date = $_POST ['msg_date'];

    At the bottom of the script.

    If {($success)
    echo "Inserted on $date ';
    } else {}
    echo "there was a problem processing your information.';
    }

    The jQuery to achieve code would be-

    Perform tasks of post-tabling
    function showResponse (responseText, statusText) {}
    $('.response').text (responseText);
    }

    More-

    success: showResponse,

    Treatment options in your ajax form

    And just include a

    where you want to display in your html code.

    PZ

    www.pziecina.com

  • query problems

    Hi, I have the following problem.

    I had a simple search. I have two tables of law area and lawyer. They are connected by lawyers ID.

    When the user makes a search it will first search of areas of the law and then all the results will be then searched in the table of lawyers by the id of the lawyer.

    I created the query, but it only gives me a name solcitors whereas it should display more. It just displays the same one again
    I have attached my queries

    Thank you

    You can also have something like:


    SELECT s.companyName FROM lawyers s, areaoflaw a
    WHERE s.solicitorid = a.solicitorid
    AND a. #areaoflaw # = yes

    AND postcode AS "#postcode #%".

    ORDER BY s.companyName

    Also, what type of data you have for the column #areaoflaw #?

    If you still get an error, please paste your error message here.

    Thank you

  • HP Pavilion Notebook - 17-f100: Internet connection, drivers problem

    Hello

    I have the HP Pavilion Notebook - 17-f100 (with bios, specifications: http://support.hp.com/hr-en/product/HP-Pavilion-17-f100-Notebook-PC-series/7234909/model/7492687/doc...) and after installing Windows7 have a problem to connect to internet, as well as to use/access to USB keys and using a mouse. Could you please help me to get more important drivers (unknown device, video controller, bus controller sm bus controller USB, PCI, ethernet, network controller controller device driver) and the most important for you to connect to the internet.

    Thanks in advance,

    Goran

    You are the very welcome.

    Here are the drivers wireless and bluetooth for this card template...

    http://h20564.www2.HP.com/hpsc/SWD/public/detail?sp4ts.Oid=6943827 & swItemId = ob_143747_1 & swEnvOid = 4058

    http://h20564.www2.HP.com/hpsc/SWD/public/detail?sp4ts.Oid=6943827 & swItemId = ob_142906_1 & swEnvOid = 4058

  • Satellite P300 - re-connection Bluetooth problem

    Good day to you all,.

    I bought a laptop Toshiba P300 BB with WiFi and bluetooth Windows Vista certified.
    Everything works fine with only the exception of the connection between my mobile phone (Nokia 6300) and the program "Nokia PC Suite"
    When I put the PC in 'sleep' by closing the lid of the screen, the bluetooth with the phone stop connection (it seems to be ok)
    When the PC is wake up by opening the lid of the screen, it will start, but the bluetooth between the phone and the PC (Nokia suite) connection is not recognized. Even trying to do it manually.
    To reactivate this connection automatically, the computer must be stopped and restarted re - a.

    The PC power is set to power and battery on "never stop".
    The action of closing the cover of PC screen is set to 'sleep' (French intelligence)

    What is going on? and what needs to be done to fix this problem?
    All your 'lights' on this topic will be welcome
    Thanks a lot
    JCP

    Hello

    This question must be post at Nokia. They have designed this software and before software is released, it must be tested. I assume that they test it on several different laptops and desktop computers.

    So why this third party software doesn't work on Toshiba must be answered by Nokia.
    Computer laptop manufacturers don't offer support for this software and cannot be responsible for the feature.

    In any case, for me is not the big problem. It cannot be that difficult to turn off the connection before switching in standby mode, or maybe close to Nokia PC Suite. After waking up, start the software again and it should work properly.

  • Satellite L450D-13U - connections WLan problems

    Hello

    I use talktalk as my internet provider.
    I started having an intermittent connection and the internet on the router light goes red. Its a d-link router.

    3 weeks a vist to a bt tech they now tell me that the problem might be my laptop.
    How could it when he connects and then removes the iradic same connection.

    Hello

    You said that the router disconnects Internet. Right?
    So how can have this cell phone number? Sorry, but I don t understand this

    In your case, I recommend to check the settings of the router.
    You should check the update of the firmware and should also check if other computers laptops/computers connected to the same router would have the same problems.

    If you are sure that your router is OK 100%, then you should check the notebooks of WLan.
    In such cases, it s advisable to update WLan driver

  • Bluetooth network and Internet connection sharing problem

    I am putting in place a network via Bluetooth between two computers later with Toshiba Stack installed and to share the Internet connection with the second computer.

    On the computer of trees I put Internet connection sharing, and for this reason, it automatically assigns addresses TCP/IP for the Bluetooth Personal Area network (192.168.0.1).
    On computer 2, I put everything to get it automatically. Firewall (Kaspersky) disabled.

    When I connect 2 Bluetooth devices, everything looks fine, the 2nd automatically gets the IP address, I can ping both computers and Internet works also on the 2nd computer, for a few seconds! After that, it appears as the 2nd computer is disconnected from the network... what could be the problem?

    In the case of the observer under the System tab, I found information like these:
    2nd comp:
    The system has detected that the network \DEVICE\TCPIP_{E44D18EB-91F5-4 adapter has been connected to the network and launched a normal operation via the network card.

    The browser has forced an election on network \Device\NetBT_Tcpip_{E44D18EB-... because a master browser was stopped.

    and the 1st model also appears this:
    The system has detected that the network Bluetooth adapter... Area Network - Packet Scheduler Miniport has been disconnected from the network, and the network adapter configuration has been released. If the network adapter was not disconnected, this may indicate that it has malfunctioned. Please contact your vendor for updated drivers.

    In your case, I would look at the following Web site:
    http://APS.toshiba-tro.de/Bluetooth/redirect.php?page=pages/HOWTO.html
    It lists the following document:
    "Internet on PDA via PAN using Notepad as a gateway."
    In your case, the PDA is another laptop, but the procedure should be very similar.
    I would check the firewall settings later if it still does not work.

  • Connection DAQ problems

    Hello

    What I want to do is quite simple (but I just can't understand ). I want to connect to an analog input to an analog output, but check this as a relay. For example, when the switch is true, my ankles are connected to the entrance on A pins passed through to the output on a PIN B. Then when the switch is set to false, the A input pins are not connected to pin B (or B axis would be output 0V).

    Problem: In the case when my switch is true, entry is passed correctly to the output. For the case when my switch is set to false, I get errors saying: "no sample provided to DAQmx don't Write initialize stamped generation." or "value required is not supported for this property value. The value of the property may be invalid because it is in conflict with another property. »

    I know that the problem is that the DAQ assistant wants some kind of entry at any time, but I'm not sure what to give him to do nothing exit.

    Attached are two attempts, I did.

    Any help would be appreciated!

    Thank you

    Nevermind, I figured it.

    Under the manipulation of the signal, I used a relay, which did not work before, but I had to change ' out when relay off "of the 'empty' to 'zero '.

  • Connectivity WiFi problem

    Hello

    My features detailed on this machine are:

    Hi George,.

    There is a good chance it's actually a connection in Greece that is causing the problem. For example, if you were in a hotel with only one router or router to elderly with multiple people who use the internet, it will cause the internet is very slow. Next time you travel in Greece trying to access the internet at the airport. Airports generally have a better router and the wireless infrastructure in place, and you see how you internet high speed is there.

    Thank you

  • HP Deskjet 970Cxi: HP printers - install another driver in Windows 7 to print USB connection cable - PROBLEM

    Hi - I have a HP Elitebook6930P running Windows 7 Ultimate x 64 and a printer HP Deskjet 970Cxi with a USB connection.

    I try to get printing to work.

    There is a 970Cxi pilot in the laptop, but it won't work.

    HP have a support document - "HP printers - installing year Alternate Print Driver in Windows 7 for a USB connection cable" - and I tried to follow this exactly a number of times without success.

    The problem is that it is inaccurate and contains instructions that do not work and refers to procedures that do not exist in Windows 7.

    Therefore, I have no success in the conclusion. I can not communicate with HP for assistance, or no explanation as to why their document will not so blatant.

    Can anyone help please?

    This widget could not be displayed.
  • Eurotherm EPower controller: query problem

    Hello

    I have a problem with communicating with a controller Eurotherm EPower (with 4 units) by OPC server.

    I use:

    -LV 8.5.1

    -iTools OPC Server 7.50 with a number of product formed the social reason (active license)

    -EPower Firmware v3.01

    Communication between LV and OPC server is made by "DataSocket write" and "Read DataSocket".

    I can write => values without problem I only write Main.SP on the evolution of events user and everything's fine.

    But on reading, I would like to read Meas.I Meas.P, Meas.V, continuous for each unit (up to 12 url request)

    The first reading is ok, so I have values, the url are ok. But after that, it is impossible to put in a loop-online no error, (status = 0 on LV and OPC Server) but the values are not updated with the following query.

    I tried to play with the option "wait for updated value", but without success.

    The only way I've found is to open the interface for server, the device, right click and select "Synchronize Active device". But this option is only a shot and very long because, I guess, he gets everything in the device...

    Another point: it works perfectly with the Engineering Studio, commonly called iTools-iTools. It is a client of the OPC server on my application.

    Another point on the other: when I run my application is the ID_EPower.exe in the list of Windows processes and consume resources (0 or 1%) so he lives.

    Complete, with one hour, I thank them but not way with Eurotherm hotline.

    My question is: Y at - it a particular way to obtain ongoing measures such as sending a query each time or a general property to get updated data?

    I used to cruise control disc from the same manufacturer with no problem and no need to send a request to get the values, but here it is perhaps a different case.

    List of requested URL:

    OPC:/Eurotherm.ModbusServer.1/CLA_Gradateurs.192-168-1-222-502-ID001-ePower.network.1.MEAs.V

    OPC:/Eurotherm.ModbusServer.1/CLA_Gradateurs.192-168-1-222-502-ID001-ePower.network.1.MEAs.I

    OPC:/Eurotherm.ModbusServer.1/CLA_Gradateurs.192-168-1-222-502-ID001-ePower.network.1.MEAs.P

    OPC:/Eurotherm.ModbusServer.1/CLA_Gradateurs.192-168-1-222-502-ID001-ePower.network.2.MEAs.V

    OPC:/Eurotherm.ModbusServer.1/CLA_Gradateurs.192-168-1-222-502-ID001-ePower.network.2.MEAs.I

    OPC:/Eurotherm.ModbusServer.1/CLA_Gradateurs.192-168-1-222-502-ID001-ePower.network.2.MEAs.P

    ... Ditto for network 3 and 4

    I joined the part of the code that is dedicated for the reading of values, but it is not really helpful because I think that my method of reading is correct (data arrive but are never updated) is a 'lack' of command to request that the server acquires new data or a bug with the LV-iTools OPC server interface...

    For LabViewers advanced, I know that my attached code is not optimized and not the smartest, but keep cool, I do not need crazy performance

    Any suggestion?

    So, I was not on the spot for the tests, but now it's ok.

    Several series shares have been made to the walkthrough to the problem, but it's hard to know if all were beneficial:

    -An update of software Eurotherm: 7.50 to 7.68

    -An update of the firmware EPower: 3.01 to 3.03

    - and probably the main cause of the problem: change the cable through a cross-wired (we thought it was, but not in reality...). But even if it is the main cause: how it was possible to receive data by forcing the update in the OPC server... strange.

    Thanks for your help.

  • Connect to problems with Windows Live Messenger. Get the 81000494 error.

    error code 81000494, how to fix

    Please help me solve the problem Windows Live Messenger sign. I tried some methods I got from forums or the internets, I couldn't have signed it ot it. I don't know if it's the blocked server connect to Windows Live Messenger. He said "signed on Windows Live Messenger failed because the service is temporarily unavailable, please try again later."  However, this had been the last for several days already. Could someone help me solve the problem.

    Thank you

    Yours faithfully,

    E-mail address is removed from the privacy *.

    Hi wongiking,

    Thanks for posting your question in the Microsoft answers Forum. For any question on Messenger, please visit the following site:

    http://windowslivehelp.com/forums.aspx?ForumID=775a2bc4-f894-4e9c-9f51-b155bbddf8d3

  • Connect disconnect problem (SL 500, windows7)

    Hello friends,

    I am facing a weird problem with my 500 SL with Windows 7 (I also lucid Linux installed on the system).

    (Note: my laptop came with Vista)

    As I begin my computer after it was closed (and NOT for a reboot) it keeps beeping sound from the start connect-disconnect power until I have completely load the operating system. (independent of windows or ubuntu) But after startup is complete he stops himself and he went after it. Anyone faced this problem? All thought it might be because?

    Some observations and comments on my machine.

    1. this product only when I start and the machine not on reboot.

    2. my vista has been currepted earlier. s I reinstalled using an another OEM my volume keys and the thinkvantage (blue) button does not work since then. (This beeper number is one or two weeks now)

    3. I noticed a little slow start for 7 but still all right.

    4. I have thinkvantage Manager of power installed. (It shows connected and disconnected when the ringing lights)

    5. my battery is old enough has around 30-40 min capacity.

    Could be it is bad, or the power port where it connects. Only way to check is by connecting another adapter compatible lenovo (good).

Maybe you are looking for

  • Deadline for messages

    Hello I m new to the forum. On my Apple Watch 42 mm I have notised that the messages over 30 days contain no more text, only the names of the senders. Is there a time limit for this? Not a big deal more than an observation, but I wonder if I missed s

  • OfficeJet pro 8500: Officejet 8500 scan of the computer

    I try to use the scan to computer option.  The scanner sends me this turn on my computer and I don't have the software and it can not find anywhere... This site has me fired everwhere and in circles.  The assistance Center has only notified me that I

  • How can I add a shadow in my images

    Hello Can someone help me how can I add a shadow on this photo? Thanks in advance!

  • Medial window sounds problems

    I have a computer compaz, having sound problems in Windows media player, no sound, but don't have sound in everything else, help please

  • Implemented new XPS 15 - remove bloatware?

    Hi could someone please refer me to a FAQ or an article with suggestions on the removal of unnecessary software to a new laptop.  First to go will be McAfee - is there other things people recommend remove? TIA