Hi Experts
I want to do left join and Join based on Case.
Basically requirement is I want to see the result All Record ,mail sent to airtel and not sent record,
if mail sent then IRActivatedPlanDetails table must have record.
not sent IRActivatedPlanDetails not have record.
Declare @MailSentToAirtel bit=1;
SELECT *
FROM IR.TravelRequestMst MST
(CASE @MailSentToAirtel
WHEN @MailSentToAirtel IS NULL OR @MailSentToAirtel=0
THEN
LEFT JOIN IR.IRActivatedPlanDetails IRTR ON MST.TravelRequestMstID = IRTR.TravelRequestMstId
ELSE
INNER JOIN IR.IRActivatedPlanDetails IRTR ON MST.TravelRequestMstID = IRTR.TravelRequestMstId
END
)
Go to the complete details ...