Reputation: 87
Here's my data:
Vacation -has Organizer column
Itinerary
ItineraryPayment - this is a cross table with Itinerary and LK_Payment. just assume that it's the name -has PaymentStatus
What I want to do is to be able to select the organizer column in Vacation and if the ItineraryPayment will be null or has a value depending if the Vacation has an Itinerary linked to it. How do I do this?
Thanks in advance!
Upvotes: 0
Views: 90
Reputation: 3065
refer this URL for Joins in SQL server.
You will get the NULL values using.
Left Join or Right Join
Upvotes: 0
Reputation: 5407
Based on what you said:
select v.organizer, (cases i.vacation_id is null then i.value else null end)
from Vacation as v
left join itinerary as i
on v.vacation_id = i.vacation_id
Upvotes: 1