I have a Complex SQL Query which is written with lot many Joins and Conditions.
ComplexQuery has few columns and most notable column names are WeightCode and DrugName.
[Assumption] : Select * from ComplexQuery.
I have a second Table : Select DrugName from Table2.
My requirement is such a way that,
If WeightCode = 2, Then First Five letters of DrugName from ComplexQuery matching First Five Letters of DrugName from Table 2 should be removed.
I am confused on approaching ..! How should i define in a single join query with filteration condition ??
Make use of
Case..Whenmay resolve your issueExample
Note : this is just example