SELECT CASE WHEN THEN (SELECT)

后端 未结 4 1364
感情败类
感情败类 2020-12-18 00:34

I am trying to select a different set of results for a product depending on a product type. So if my product should be a book I want it to look up the UPC and Artist for a n

4条回答
  •  悲&欢浪女
    2020-12-18 00:36

    You Could try the other format for the case statement

    CASE WHEN Product.type_id = 10
    THEN
    (
      Select Statement
    )
    ELSE
    (
      Other select statement
    
    )  
    END
    FROM Product 
    WHERE Product.product_id = $pid
    

    See http://msdn.microsoft.com/en-us/library/ms181765.aspx for more information.

提交回复
热议问题