I have two tables in a database and I wish to select all entries from one table but only certain entries, which are associated by ID, from the second. I've tried using a JOIN but so far all I have been able to figure out how to do is join the tables and therefore select the two entries where both tables match.
Here's the code so far:
SELECT C.ConfigDescription, D.DDI, C.ConfigDefault
FROM tConfigurations C
JOIN tDDIs D ON D.ConfigurationID = C.ID
WHERE D.AccountID = 1307
'1307' is for testing purposes is a hard coded value of a variable that's being passed in through a stored procedure.
What I want to do is select all the "D.DDI"s from the tDDIs table regardless of whether or not they have associated entries with the tConfigurations table. And where entries do have associated entries I want to display the "C.ConfigDescription" and "C.ConfigDDefault" from the the tConfigurations table.
Thanks in advance guys.