經常遇到獲取數據表中多個列的最小值和最大值,例如: 獲取這 4個價格的最小值和最大值: SELECT( SELECT min(minPrice) FROM ( VALUES (IIF(MarketSingleImagetextPrice=0,null,MarketSingleImagetextPri ...
經常遇到獲取數據表中多個列的最小值和最大值,例如:
獲取這 4個價格的最小值和最大值:
SELECT
(
SELECT min(minPrice)
FROM
(
VALUES
(IIF(MarketSingleImagetextPrice=0,null,MarketSingleImagetextPrice)),
(IIF(MarketMoreGraphicOnePrice=0,null,MarketMoreGraphicOnePrice)),
(IIF(MarketMoreGraphicTwoPrice=0,null,MarketMoreGraphicTwoPrice)),
(IIF(MarketMoreGraphicThreePrice=0,null,MarketMoreGraphicThreePrice))
) AS #temp(minPrice)
) AS MinIboPrice
FROM YX_WeChatFlowMode WHERE ShapeID=1 AND FlowID = 1656