I want to return all users, and if they went to a conference I want to return the conference information. The @ConferenceID will be a parameter.
SELECT
U.UserId,
O.ConferenceName,
O.LocationName
FROM Users
My outer join will need something like:
SELECT *
FROM Conferences C
INNER JOIN Locations L ON C.LocationId = L.LocationId
WHERE UserId = ??
AND C.ConferenceID = @ConferenceID
Is it possible to perform an outer join so that all users are returned, and then optionally display the conference info if they went to one?
I tried this:
SELECT
U.*,
oj.
FROM Users U
OUTER JOIN (
SELECT c.ConferenceName, L.LocationName
FROM Conferences C
INNER JOIN Locations L ON C.LocationId = L.LocationId
WHERE C.ConferenceID = @ConferenceID
) AS oj.UserID = U.UserID
But I get an error
The multi-part identifier "U.UserId" could not be bound.
DDL:
User
-UserId
Conference
-ConferenceID
-UserID
-LocationId
Locations
-LocationID