-1

当某些条件为真时,我想进行内部连接

case  
when (select dbo.fnGetProduct_config('CATEGORY_NAME','',''))='XYZ'  
then inner join product_master t12 on t12.id=t1.product_id  
END  
4

2 回答 2

5

您不能使用条件来决定是否加入(动态 sql 除外),但您可以将谓词添加到联接中......

...
from table1
inner join product_master t12 on t12.id=t1.product_id and dbo.fnGetProduct_config('CATEGORY_NAME','',''))='XYZ'
于 2013-11-01T05:06:38.500 回答
-1
SELECT * FROM TABLE1 T1
INNER JOIN TABLE2
 ON (fn(T1.Blahblah)==1 AND /*other conditions*/)
于 2013-11-01T05:08:22.503 回答