Novice Select SQL Statement (1 Viewer)

dungstar

Registered User.
Local time
Today, 02:45
Joined
Mar 13, 2002
Messages
72
This should be a simple SQL statement; I've done it before but just can't figure it out now.

I have a LabSample table. The lab sample has couple fields that are foreign keys TechID (from Technician table) and ProjectID (from Project table).

Not all records in the LabSample table contain a TechID or ProjectID.
Under the Technician table, the attributes are TechID (PKey), TechName.
Under the Project table, the attributes are ProjID (PKey) and PI (investigator).

I am trying to create a query, that shows all LabSample attributes and if a TechID exist, also show TechName, and if ProjID exist, also show the PI.

Thanks for your help!
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 21:45
Joined
Feb 19, 2002
Messages
43,374
You need to use Left or Right Joins rather than Inner Joins in situations where the foreign key values may be null. Open the query in QBE view and right click on the center of each join line. Choose the second or third option depending on which table is on the left.
 

Users who are viewing this thread

Top Bottom