hi..can somebody help me?
how can i have a conditional join in my statement.
i have a parameter to be passed to the SP: @pRemarks
my main query:
select * from MasterList
if @pRemarks='ALL' then my query will be:
select * from MasterList inner join tblPositionLists on tblPositionLists.Position = MasterList.Position
else if @pRemarks='LEVEL' then my query will be:
select * from MasterList inner join tblPositionLists on tblPositionLists.PositionLevel = MasterList.PositionLevel
how can i achieve this through CASE WHEN? (or anything else)
.as you noticed, same table to be joined but different in column to be referenced to. But I dont want this to use IF else because the query is longer than this.