Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2002
    Posts
    5

    Unhappy Unanswered: In need of help with SQL statements!!

    Hiya! Need help!

    I have 2 tables with the following data:

    Professor_table
    prof_number prof_name
    1 John, Paul
    2 Gomez, Jose
    3 Smith, Lisa
    4 Ronald, Tom
    5 Wong, Frank
    6 Jetson, Jack
    7 THomas, Nik

    Course_table
    prof_number class_num
    1 BIS 100
    1 BIS 500
    1 BIS 510
    2 BIS 500
    2 BIS 510
    3 BIS 310
    3 BIS 210
    4 BIS 310

    I need to get a list of the professors who teach the same courses and the course they teach. Only professors who teach the same course as another professor should be on the list.

    so my list shoud have:

    BIS 310 Smith, Lisa
    Ronald, Tom
    BIS 500 John, Paul
    Gomez, Jose
    BIS 100 John, Paul
    Gomez, Jose

    CAN ANYONE PLEASE HELP ME!!!!????

  2. #2
    Join Date
    Nov 2002
    Location
    Desk, slightly south of keyboard
    Posts
    697
    select
    class_num,
    prof_name
    from
    course_table c,
    professor_table p
    where
    c.class_num in
    (
    select class_num
    from course_table
    group by class_num
    having count(*) > 1
    ) and
    c.prof_number = p.prof_number

    HTH
    Bill

  3. #3
    Join Date
    Nov 2002
    Posts
    5
    Thanx billm!! :-)

Posting Permissions

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