Problems with distinct query ...

Discussion in 'MySQL' started by pepe_lepew1962, Mar 29, 2010.

  1. #1
    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";
     
    pepe_lepew1962, Mar 29, 2010 IP