MySQL Forums
Forum List  »  Newbie

help with a simple query problem SQL
Posted by: robert davies
Date: March 29, 2005 01:01PM

I have the query below that currently works, using the tables MODULE and STAFF. The relationship is the module is taught by a worker in the staff tables

SELECT module.ModuleCode, module.Title, module.Semester,module.StaffID_1, staff.name, staff.Email
FROM module
INNER JOIN staff ON module.StaffID_1 = staff.staffID' ;

However

In the module table there is an option for a second staffID (StaffID_2) this can be a null vaule and in most cases is.

I need to alter the query above so that when there is a value in staffID_2 their details (name and email address) are brought up along with staffID_1's details

ie query would produce

ModuleCode--Title--Semester--StaffID_1--Name--Email--StaffID_2--Name--Email

Options: ReplyQuote


Subject
Written By
Posted
help with a simple query problem SQL
March 29, 2005 01:01PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.