Advanced Search

Results 1 to 2 of 2

Thread: can't figure out mysql query ...

  1. #1
    Join Date
    Nov 2008
    Posts
    42
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default can't figure out mysql query ...

    Hi:

    I am very new at this and totally confused as to what query I need. Here is my problem. We have bus trips all over the place and allow our drivers to put a request on routes as they become available. When the driver logs in, a session with his/her id is created. Now, display all the routes that the driver has not requested on. On the example below, when "PB" logs in and the session is created, display trips 1234, 1236, 1237 and 1238. I have a command button that is next to each trip that the driver would click and load a new screen with trip details. My problems is how to limit trips that the driver has NOT put a request on.

    $D_Name = $_SESSION['sesdrivername01'];

    tblTRIPS:
    Trip_Num Trip_From Trip_To
    1234AB Dallas Miami
    1235AB Ft Worth Montreal
    1236AB Houston Phoenix
    1237AB Seattle Tacoma
    1238AB Portland Vegas
    //
    //
    tblDRIVER:
    Driver_Load Driver
    1235AB PB
    1235AB AJ
    1237AB PB


    $frmTrip101 = "SELECT DISTINCT Trip_Num,Trip_From,Trip_To,Driver_Load FROM tblTRIPS, tblDRIVER where tblTRIPS.Trip_Num != tblDRIVER.Driver_Load";

  2. #2
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    1,681
    Thanks
    78
    Thanked 89 Times in 87 Posts

    Default

    Try this:

    Code:
    SELECT tblTRIPS.Trip_Num FROM tblTRIPS, tblDRIVER WHERE 
    tblDRIVER.Driver_Load=tblTRIPS.Trip_Num AND tbl.DRIVER.Driver NOT LIKE '%PB%'
    To choose the lesser of two evils is still to choose evil. My personal site

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •