Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2002
    Posts
    3

    Unanswered: Need help with a 3 table query

    Hi all,

    I need some help with a query (SQL Server 7.0):
    I have 3 tables:

    tbl_trainer_bookings
    .trainer_booking_id PK
    .slot_id
    .trainer_id

    tbl_slots
    .slot_id PK

    temp1 (temporary table, trainer_id could be considered PK)
    .trainer_id

    I need a list of all combinations of
    trainer_id and slot_id that are not in
    tbl_trainer_bookings.

    Hope this is a clear enough explanation,
    and that somebody will be able to help me!

    Regards,

    Ballonier

  2. #2
    Join Date
    Sep 2002
    Location
    UK
    Posts
    5,171
    Provided Answers: 1

    Re: Need help with a 3 table query

    That's easy:

    SELECT trainer_id, slot_id
    FROM temp1, tbl_slots
    MINUS
    SELECT trainer_id, slot_id
    FROM tbl_trainer_bookings ;

Posting Permissions

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