Can anyone please explain me how can we use join on the basis of condition. Lets say i am filtering data on the basis of a condition now my concern is if a particular BIT type parameters value is 1 then the data set include one more join else return same as earlier. Here is three tables A,B,C now i want to make a proc which has the @bool bit parameter
if @bool=0
then
select A.* from A
inner join B on B.id=A.id
and if @bool=1
then
select A.* from A
INNER JOIN B on B.id=A.id
inner join C on C.id=A.id
Thanks In Advance.