I have a stored procedure with a number of parameters. I would like to write my query so that it joins with certain tables but only if a particular parameter has a value. Take
Join the three tables together and use something like this in your WHERE clause:
WHERE Addresses.ID = COALESCE(@AddressID, Addresses.ID) AND Groups.ID = COALESCE(@GroupID, Groups.ID)