当某些条件成立时,我想做内连接
case
when (select dbo.fnGetProduct_config('CATEGORY_NAME','',''))='XYZ'
then inner join product_master t12 on t12.id=t1.product_id
END
Run Code Online (Sandbox Code Playgroud)
您不能使用条件来决定是否加入(动态sql除外),但您可以将谓词添加到连接....
...
from table1
inner join product_master t12 on t12.id=t1.product_id and dbo.fnGetProduct_config('CATEGORY_NAME','',''))='XYZ'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
111 次 |
| 最近记录: |