Can I use CASE statement in a JOIN condition?

前端 未结 9 2024
庸人自扰
庸人自扰 2020-11-22 09:32

The following image is a part of Microsoft SQL Server 2008 R2 System Views. From the image we can see that the relationship between sys.partitions and sys

9条回答
  •  北荒
    北荒 (楼主)
    2020-11-22 09:50

    Try this:

    ...JOIN sys.allocation_units a ON 
      (a.type=2 AND a.container_id = p.partition_id)
      OR (a.type IN (1, 3) AND a.container_id = p.hobt_id)
    

提交回复
热议问题