$ 0 0 declare @id int select * from tablea inner join case when @id = 1 then tableb on a.id = b.id when @id = 2 then tablec on a.id = c.id else 'dont join' endcan some one please help me