Null Values in a Join

saleemMSMS

Registered User.
Local time
Tomorrow, 03:37
Joined
Aug 12, 2009
Messages
92
well, i have 3 tables

ProgrammingLanguages
LangID | LangName

GraphicsSoftware
softwareID | SwName

StudentInfo
StudentID | softwareID | LangID

the student info as shown above has softwareID and LangID as foreign keys to GraphicsSoftware and ProgrammingLanguages Tables Respectively.
but null values are allowed in the StudentInfo Table so some students may not have either softwareIDs or LangIDs or even both.

finally i want to construct a query to display all he students with following infomation

StudentID LangName Swname

in order to do that, i designed the following code
Code:
select studentID, GraphicsSoftware. Swname, ProgrammingLanguages. LangName  
from StudentInfo INNER JOIN GraphicsSoftware on GraphicsSoftware. softwareID = StudentInfo. softwareID  INNER JOIN ProgrammingLanguages ON ProgrammingLanguages.LangID = StudentInfo. LangID

but this code does not return fields with null values.

is there a way to return all values of the studentInfo table ?
 
Last edited:
You have to use RIGHT JOIN.
Look at attachment (word, zip)
 

Attachments

You have to use RIGHT JOIN.
Look at attachment (word, zip)

Or left, depending on the way you build (dragged) it.

In the query builder double click the relationship line, this opens an interface with 3 options.
Read the description and pick the one you need.
 
In the query builder double click the relationship line, this opens an interface with 3 options.
Read the description and pick the one you need.

it was very informative.. thanx namliam :)
 

Users who are viewing this thread

Back
Top Bottom