Need query for connecting flights

Hi all.
My requirement is as follows
suppose my itnery is AAA-BBB-CCC.And there are few flights between AAA-BBB and BBB-CCC.I need all the valid connecting flights everyday.My table data is as follows
orig dest fltno arrivaldate depdate legno itid
AAA BBB 121 23-05-2011 15:40:00(arrical ar BBB) 1 x
AAA BBB 123 23-05-2011 16:40:00(arrical ar BBB) 1 x
BBB CCC 212 24-05-2011 04:05:00(arrical ar CCC) 23-05-2011 19:50:00(depat from BBB) 2 x
BBB CCC 213 24-05-2011 13:05:00 (arrical ar CCC) 24-05-2011 04:50:00(depat from BBB) 2 x
now i need to get for legno 1 all the flights in leg 2, whose depdate is grater than arrival date in leg 1.
Thanks.

Hi,
Whenever you have a problem, please post CREATE TABLE and INSERT statements for the sample data. Also post the results you want from that data, and an explanation of how you get those results from that data, with specific examples.
Always say which version of Oracle you're using.
If I understand the problem, then you can use somehting like this:
SELECT     l2.*
FROM     table_x       l1
JOIN     table_x       l2   ON   l2.legeno     = l1.legno + 1
                 AND  l2.orig     = l1.dest
                 AND  l2.depdate     > l1.arrivaldate
WHERE     l1.legno     = 1
;A self-join, like this, will work if you're looking for a specific leg. If you're interested in all legs (or all legs after a certain point), regardless of whether that's 1, 2, 3 or more, then use CONNECT BY instead of a self-join.

Similar Messages

  • Need Query for empty partitions

    I am having nearly 700 partitions for a table.Now i want to find out only the empty partitions.I need query for that.
    Thankx..

    Not the most elegant solution, but it works:
    declare
    rc number;
    str varchar2(200);
    begin
    for i in (select table_owner, table_name, partition_name from dba_tab_partitions) loop
    str := 'select count(*) from ' || i.table_owner || '.' || i.table_name || ' partition (' || i.partition_name || ')';
    execute immediate str into rc;
    if rc = 0 then
    dbms_output.put_line(i.table_owner || '.' || i.table_name);
    end if;
    end loop;
    end;

  • Need Information For Connecting Access point to WLC 4402

    Hi Friends
    I need Some information for Connecting  my New Access point ( Cisco AIRLAP 1242AG) with WLC(4402) Controller
    In our network set up we have two WLC(4402) we needs to Connect this New Accesspoint To one of our WLC
    My Access point is brand New. I need to Know what all i have to do inorder to connect this AP to the controller (from Acesspoint perspective & WLC perspective)
    I need to Know  what I need to do in AP to connect to the Controller
    Do i need to Assign Static IP Address forAP or after connecting to the switch it automatically gets ip from DHCP and regsiter with controller??
    Do i Need to Configure my AP with default gateway(the switch to which is connected ?) & DO i need to configure the AP with  Controller Ip address ??
    Pls Assist
    Regards
    Safwan

    Hi Scot...
    We tried Connecting the Access Point yesterday, but it failed....
    We are using Cisco 3500 Access point ...
    when we connected , first it automatically got an ip address using DHCP but following error occurred
    P70ca.9bd5.77c6#
    AP70ca.9bd5.77c6#
    AP70ca.9bd5.77c6#
    Not in Bound state.
    *Mar  1 00:13:56.539: %CAPWAP-3-ERRORLOG: Invalid event 38 & state 2 combination
    *Mar  1 00:13:56.555: %DHCP-6-ADDRESS_ASSIGN: Interface GigabitEthernet0 assigne
    d DHCP address 10.50.11.26, mask 255.255.0.0, hostname AP70ca.9bd5.77c6
    *Mar  1 00:14:04.564: %CAPWAP-3-UNSUPPORTED_WLC_VERSION: Unsupported version 6.0
    .182.0 on WLC USSTLController01
    *Mar  1 00:14:14.564: %CAPWAP-3-UNSUPPORTED_WLC_VERSION: Unsupported version 6.0
    .182.0 on WLC USSTLController01
    *Mar  1 00:14:24.564: %CAPWAP-3-UNSUPPORTED_WLC_VERSION: Unsupported
    version 6.0
    .182.0
    version 6.0
    .182.0
    on WLC USSTLController01
    version 6.0
    .182.0
    Then I COnfigured Ap with  Static ip address & default gateway & controller Ip but tht too didnt work...
    .182.0 on WLC USSTLController01
    AP70ca.9bd5.77c6>
    AP70ca.9bd5.77c6>
    AP70ca.9bd5.77c6>
    AP70ca.9bd5.77c6>
    *Mar  1 00:13:40.908: %CDP_PD-2-POWER_LOW: All radios disabled - NEGOTIATED WS-C
    3750X-48P (e05f.b907.9a20)
    AP70ca.9bd5.77c6>
    AP70ca.9bd5.77c6>
    AP70ca.9bd5.77c6>en
    Password:
    AP70ca.9bd5.77c6#
    *Mar  1 00:13:48.033: %CAPWAP-3-DHCP_RENEW: Could not discover WLC using DHCP IP
    . Renewing DHCP IP.
    AP70ca.9bd5.77c6#
    AP70ca.9bd5.77c6#
    AP70ca.9bd5.77c6#
    P70ca.9bd5.77c6>
    *Mar  1 00:13:40.908: %CDP_PD-2-POWER_LOW: All radios disabled - NEGOTIATED WS-C
    3750X-48P (e05f.b907.9a20)
    AP70ca.9bd5.77c6>
    AP70ca.9bd5.77c6>
    AP70ca.9bd5.77c6>en
    Password:
    AP70ca.9bd5.77c6#
    *Mar  1 00:13:48.033: %CAPWAP-3-DHCP_RENEW: Could not discover WLC using DHCP IP
    . Renewing DHCP IP.
    I also  Need to Know Cisco Access point 3500 can be associated with WLC 4402 ( version 6.0.182.0) ??
    Pls Advice How to proceed further

  • Need help for connecting internet in solaris 10

    Hello ,
    I am new to Sunsolaris, recently i installed solaris 10 in my HP laptop. In my lap vista is the host and i installed Virtual box 3.0. Inside virtual box i installed solaris. My problem is not able to connect to internet. Iam using a wireless modem for connecting internet which is configured in vista. Solaris is not identifying wireless modem. Virtual box host adaptor is the ethernet iam using. I want to connect solaris to vista and access the internet( i have a guest open suse Linux in my lap, this is able to connect to internet through vista) can anybody give me a solution to get internet in solaris(ie through vista)
    Biju

    Hi,
    What is the gateway used by Solaris. Please send the result of ifconfig -a on the Sun OS.
    Sunil.

  • Need help for connecting Ms Acces with java Swing in Mac OS

    Hi all,
    i need to connect to Ms Access in MAc os through my java swing program.
    Is it possible for accessing Ms access through dsn in Mac OS.
    If Possible which driver shall i use for Establishing Connection with MS Access in Mac OS.
    Suggestion is needed urgently.
    Can anybody help me out regarding this..
    Thanks in advance.
    Regards,
    sreand

    if I don't find a better solution I'll try your 2nd option but what do you mean by "combo" update?
    My understanding is to simply insert the OS 10.5 installation CD, reinstall the OS and the just keep updating it via the OS SSoftware update panel and stop untill I see the scary Java 8 update. Is that what you meant?
    While you can do it that way, the combo update picks up operating system updates through a collection of releases. When dealing with operating system upgrades, I've found using the combo updates to be more reliable than Software Update, as sometimes Software Update doesn't apply updates correctly, and weird things can happen. Doesn't happen often though, thankfully.
    So the OS X 10.5.5 Combo update contains all updates between 10.5.0 and 10.5. The 10.5.8 combo update contains the updates from 10.5 thru 10.8. Here are the updates:
    10.5 combo update: http://support.apple.com/kb/DL692
    10.8 combo update: http://support.apple.com/kb/DL866
    If you go down the combo path, repair permissions before and after doing each update. Then do Software Update for any other non-OS X updates, and don't apply the Java Update 8.

  • Need Query for Item Relationship of Oracle Apps

    Hello Team,
    I need the Query to select the Item Relationship.
    In Oracle Apps we have different tyes of Structure
    ItemA -> ItemB
    ItemB -> ItemC
    ItemC -> ItemD
    ItemG -> ItemH
    ItemK -> ItemL
    ItemW -> ItemQ
    and this also is possible (meand many to one relationship)
    ItemA -> ItemB
    ItemB -> ItemC
    ItemC -> ItemD
    ItemT -> ItemD
    and in the Select Query i want the below result
    ItemA -> ItemB 1
    ItemB -> ItemC 2
    ItemC -> ItemD 3
    ItemG -> ItemH 1
    ItemK -> ItemL 2
    ItemW -> ItemQ 1
    and this also is possible (means many to one relationship)
    ItemA -> ItemB 1
    ItemB -> ItemC 2
    ItemC -> ItemD 3
    ItemT -> ItemD 1
    means i want the Hierarchy number also
    Please help me to in order to get the relationship by sql query.
    Kind Regards,

    thanks for the quick response and i would love to spend time perusing the forum for this question but i didn't have time today.  i'll do that now though.
    what i'm mostly interested in is a chronological view (lastUpdateDate) of the change to pricing for an item in the system.  there is a lot of activity in our system around price changes for promotions and i want to keep track of when it's changed in the source system and pair that with our other downstream systems.
    i'm assuming we can add this functionality through a udf some way or maybe sp_TransNotification proc?

  • Need query for requistion and rfq numbers

    Dear All,
    I need a query to list all requisition number for which RFQ is created and RFQ  is partially converted to PO, if RFQ is fully converted to PO, it should not fetch the details.please help me on this.
    Thanks
    Debendra

    Are you referring to sourcing RFQ or core quotations?

  • Need advice for connecting MIDI-apparat to pc

    Hello,
    I have a digital piano which i want to connect to my computer. So i can use some software to record notes being played.
    Which would be the most obvious way in connecting it? Just a MIDI-USB data cable (or a MIDI-Gameport. I still have an old SBLive) or do I need to buy an MIDI interface like for example a M-Audio MIDIman?
    Is there anyone who could give advice in what is the easiest way? Because I dont want to spend weeks on how to get things working. I had that before with other stuff
    Thanks.

    A Midi-USB cable will work, but be wary of any cheap brands as this can give problems with unofficial extensions like Yamaha's XG or Roland's GS (or like above, high latency) I have an E-MU X-midi 1x1 USB Tab myself. Works fine with my keyboard, both ways, but I can't transfer any songs into the database (not sure whether it's the cable of Yamaha's crappy software).
    Last edited by Cilph (2011-09-02 01:50:37)

  • Need Help for connectivity USB Cable Nokia 5800 ca...

    Hi All,
    I really need help to solve my problems. I just bought nokia 5800 XM last week. I already installed the CD software in my windows XP, but it seems that PC cannot recognize the USB cables. I have plug in an unplugged... At firstime it detects my nokia 5800 XM, but when I open PC suite or OVI, it doesn't connect the USB cables into PC. I already install and uninstall The OVI suite but it is still the same, when I try it in OVI suite to detect my phones, it doesn't react.... I also have download from Nokia website to install manually Nokia USB cable driver for my  cable type CA-101... it seems nothing works here... tell me what should I do? I don't think that the USB cable I bought is fake, it has original guarantee..... please desperately need help! Anybody? 

    When you plug the phone into the computer, ON THE PHONE it should ask you which mode to connect in, and you should select "PC Suite" mode.  Does this happen?
    Ravi

  • Need Query for this

    Report Builder Version:10g
    Hi Guys Good Morning to one and all
    I have a table Named Onlsuvdet which captures the answers from
    an online survey front end which has multiple choice questions.
    the table structure is as follows
    create table onlsuvdet(shloid number,questno char(5),respo1 char(5),respo2 char(5));
    and the sample data is as follows
    SHLOID QUEST RESPO RESPO
    9315 1 2
    9315 2 3
    9315 3 4
    9315 3 5
    9315 4 1
    9315 5 2
    9315 5 1
    Now i want the result as follows
    shlogid quest1 quest2 q3 q4 q5
    9315     2 3 4,5 1 2,1
    So my requirement is a query which displays this data as above.
    Please helpppp
    Any help will be appreciated :)
    Thanks & Regards

    Hi,
    user123 wrote:
    Report Builder Version:10g
    Hi Guys Good Morning to one and all
    I have a table Named Onlsuvdet which captures the answers from
    an online survey front end which has multiple choice questions.
    the table structure is as follows
    create table onlsuvdet(shloid number,questno char(5),respo1 char(5),respo2 char(5));Thanks for posting the CREATE TABLE statement. That helps.
    Why are you using the CHAR datatype, rather than VARCHAR2? CHAR is nothing but trouble.
    and the sample data is as follows
    SHLOID QUEST RESPO RESPO
    9315 1 2
    9315 2 3
    9315 3 4
    9315 3 5
    9315 4 1
    9315 5 2
    9315 5 1Always post your data in a form people can use to re-create the problem and test their solutions. for example:
    INSERT INTO onlsuvdet (shloid, questno, respo1, respo2) VALUES (9315, '1    ', '2    ', NULL);
    INSERT INTO onlsuvdet (shloid, questno, respo1, respo2) VALUES (9315, '2    ', '3    ', NULL);
    INSERT INTO onlsuvdet (shloid, questno, respo1, respo2) VALUES (9315, '3    ', '4    ', NULL);
    INSERT INTO onlsuvdet (shloid, questno, respo1, respo2) VALUES (9315, '3    ', NULL, '5    ');
    INSERT INTO onlsuvdet (shloid, questno, respo1, respo2) VALUES (9315, '4    ', '1    ', NULL);
    INSERT INTO onlsuvdet (shloid, questno, respo1, respo2) VALUES (9315, '5    ', '2    ', NULL);
    INSERT INTO onlsuvdet (shloid, questno, respo1, respo2) VALUES (9315, '5    ', NULL, '1    ');I'm making a lot of guesses about the data. for example, I'm guessing there will never be more than 2 rows with the same shloid and questno.
    Why do you have 2 columns, respo1 and respo2? Is exactlyly one of them always NULL? If respo1 is NULL, will there always be another row with the same shloid and questno, but with a NULL respo2?
    Now i want the result as follows
    shlogid quest1 quest2 q3 q4 q5
    9315     2 3 4,5 1 2,1Be consistent with the column names; either call them all questn (like I did below) or call them all qn.
    So my requirement is a query which displays this data as above.Perhaps something like this:
    WITH     joined_data     AS
         SELECT     r1.shloid
         ,     r1.questno
         ,     RTRIM ( r1.respo1 || ',' || r2.respo2
                    )     AS respo
         FROM                onlsuvdet     r1
         LEFT OUTER JOIN     onlsuvdet     r2  ON     r1.shloid     = r2.shloid
                                         AND     r1.questno     = r2.questno
                                         AND     r1.respo1     IS NOT NULL
                                 AND     r2.respo2     IS NOT NULL
    SELECT       shloid
    ,       MAX (CASE WHEN questno = '1    ' THEN respo END)     AS quest1
    ,       MAX (CASE WHEN questno = '2    ' THEN respo END)     AS quest2
    ,       MAX (CASE WHEN questno = '3    ' THEN respo END)     AS quest3
    ,       MAX (CASE WHEN questno = '4    ' THEN respo END)     AS quest4
    ,       MAX (CASE WHEN questno = '5    ' THEN respo END)     AS quest5
    FROM       joined_data
    GROUP BY  shloid
    I hope this answers your question.
    If not, point out a few places where the query above gets the wrong results. Post the correct results (formatted, between \ tags, as explained in the FAQ
    http://wiki.oracle.com/page/Oracle+Discussion+Forums+FAQ
    ) and explain how you get the correct results from the given data.  Correct or add to the sample data that I psoted, if necessary.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Need help for connection problem

    When I try to run JdbcCheckup.java, I get following problem:
    password: tiger
    database(a TNSNAME entry): myhost:1521:orcl
    Connecting to the database...Connecting...
    Exception in thread "main" java.sql.SQLException: Io exception: The Network Adap
    ter could not establish the connection
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:156)
    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
    at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:212)
    at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
    va:251)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:224)
    at java.sql.DriverManager.getConnection(Compiled Code)
    at java.sql.DriverManager.getConnection(DriverManager.java:137)
    at JdbcCheckup.main(Compiled Code)
    I'm very appreciated for everybody's help
    null

    This example can be run without specifying a TNSNAME connection string, as the oci8 jdbc driver will default to the localhost. OR - Specifying the only the TNSNAME is required, i.e. edit %ORACLE_HOME%\network\ADMIN\TNSNAMES.ORA file and locate the XXXXX.WORLD entry in the file. This is the TNSNAME entry referred to.
    Try re-running this as follows (with no TNSNAME entry at all):
    %ORACLE_HOME%\jdbc\demo\samples\oci8\basic-samples> java JdbcCheckup
    Please enter information to test connection to the database
    user: system
    password: manager
    database (a TNSNAME entry):
    Connecting to the database...Connecting...
    connected.
    Hello World
    Your JDBC installation is correct.
    null

  • Need help for connecting in an RSA authentication agent

    i am not sure if this is the right place but i was hoping i am lucky enough for someone with knowledge about rsa or somebody who has experience in developing security pages.
    my problem is something like this, simple, how do i connect to an RSA Authentication Agent, or RSA Authentication Manager.
    i was hoping you could paste an answer or paste an web address of a forum.
    this kind of question is very rare in forums, so i don't really have much choice. any relevant answers are appreciated...
    thank you

    Hi,
    What is the gateway used by Solaris. Please send the result of ifconfig -a on the Sun OS.
    Sunil.

  • Need Query for Update

    CREATE TABLE TEST_MATCH
    MTCH1 NUMBER(9),
    MTCH2 NUMBER(9),
    UPDT_MTCH CHAR(2 BYTE),
    UPDT_NBR NUMBER(10)
    SET DEFINE OFF;
    Insert into TEST_MATCH
    (MTCH1, MTCH2, UPDT_MTCH)
    Values
    (2616131, 300137070, '02');
    Insert into TEST_MATCH
    (MTCH1, MTCH2, UPDT_MTCH)
    Values
    (2571056, 300129277, '02');
    Insert into TEST_MATCH
    (MTCH1, MTCH2)
    Values
    (2623529, 300175046);
    COMMIT;
    i need to update the column UPDT_NBR which is currently NULL
    UPDATE TEST_MATCH
    SET UPDT_NBR =
    NVL(2616131, 300137070) FOR THESE TWO MATCHES-> (1234567),
    (2571056, 300129277) FOR THESE TWO MATCHES -> (1111111),
    (2623529, 300175046) FOR THESE TWO MATCHES ->(222222);
    Thanks for all your help in my previous post. And thanks again for looking into my post.

    Hi,
    If it is just three records it would be better if you fire individual update statement 3 times.
    But if it is a sample data only and you have many updates to do then only way I think it is is possible is either by creating temporary table or using subfactoring(same as creating temporary table)
    Regards
    Anurag

  • Need query for refresh test database.

    Hi,
    I want refresh production database to test database refresh using expdp dumpfile. Please provide steps this is the requirement
    This request is to refresh the Tecnomatix test database MFEM which is
    on the NATEST server wnmcdwtk.natest.gm.com. This database needs to
    be refreshed using an Oracle full backup dump file from the Tecnomatix
    production database MFEP which runs on the production NAENG server
    wnmcdds8.naeng.gm.com. The MFEM and MFEP databases are both at Oracle
    v10.2.0.4.

    Hi,
    You have posted to the wrong section of the forum. This forum us for Berkeley DB.
    Regards,
    Alex Gorrod
    Oracle Berkeley DB

  • I need Help for Connect To DB2 with JDBC

    I'd like to know why I Have this problem.
    The DB2 v 5.10 is in a IBM OS/390
    I know the IP, PORt, DBNAME and I'd like to connect to DB2 with my windows XP using JDCB from IBM.
    I use JDBC Universal for DB2 type 4.
    Class.forName("com.ibm.db2.jcc.DB2Driver");
    Url = "jdbc:db2://IP:PORT/BDNAME";
    DriverManager.getConnection.... (url, user, pass)..
    If I execute this, I have next problem
    SQL state = null
    Error code = -4499
    There is no available conversion for the source code page, 1208, to the target code page, "". DB2ConnectionCorrelator: null
    Why is this?
    Finally, the web application will running in a AIX IBM with machine, It could be that this machine (aix) can connect with the IBM OS/390 with JDBC for iBM?
    Thankss!!!

    Check how you configured the IP on the laptop and computers, assigned by router with DHCP feature enabled? Or configure manually? If it's assigned by wireless router, then make sure you assign big enough IP range in DHCP setting. Take a look on using ping to troubleshoot network and wireless router configuration articles to help you more..

Maybe you are looking for

  • Opening downloaded dmg files

    Any file that I download that is dmg will not open. I get the message that it failed to mount. If I check get info on the file it says it should open with disk image mounter. when I click on it it eventually says device not configured. I tried openin

  • Contact Person Determination - Activity Management

    The Partner determination for our Activity Management's Contact Person is set up this way: 1 - Number of occurences (Highest): 1 2 - Access Sequence: Preceding Document > BP Relationships: Activity Partner However, whenever I input the Activity Partn

  • Full Screen Button in Captivate Player?

    I'm adding captivate demos into my RoboHelp 8 project and was wondering if one could add a Full Screen button to the captivate player to enable the same functionality that is now available when adding Captivate movies to PDFs. Thanks!

  • Dead Ethernet port ATV, will Apple USB connector work?

    My ethernet port on my ATV died. I have made sure the cable and switch are okay (by connecting to another device). I have done a factory restore since this port worked until a couple of weeks ago. Will the Apple USB ethernet adapter and plug this int

  • Cannot open the reader

    When trying to open a document I get the following message "Before proceeding you must first launch Adobe Acrobat and accept the End User License Agreement" I am using safari on Mavericks