首页 > 代码库 > case when 的实战应用

case when 的实战应用

SELECTlg.product_id,lg.goods_id,lg.goods_no,lg.product_price,lg.product_stock,lg.limit_amount,lg.is_delivery_free,lg.limit_order,lg.state,gs.MARKET_PRICE,lg.standby1 AS kan_product_stock,sg.goods_name,<![CDATA[(CASE   WHEN lg.LIMIT_GOODS_IMG IS NOT NULL      THEN lg.LIMIT_GOODS_IMG    ELSE sg.goods_list_imgEND) AS goods_list_img, ]]>sg.goods_price,lg.cu_titleFROMT_LIMIT_GOODS lg,shop_common_goods sg,(SELECTgg.market_price,gg.goods_idFROMproduct pp,goods ggWHEREgg.PRODUCT_ID = pp.product_idAND pp.is_onsale = YAND pp.is_delete = NAND gg.is_delete = N) gsWHERElg.goods_id = sg.goods_id(+)AND lg.goods_id = gs.goods_idAND lg.is_delete = NAND sg.is_delete = NAND lg.state = enableAND <!

[CDATA[ to_date(lg.limit_begin_time, ‘YYYY/MM/DD hh24:mi:ss‘)<=to_date(#{limitEndTime}, ‘YYYY/MM/DD hh24:mi:ss‘)]]>AND sg.goods_type = #{goodsType}AND lg.field_id = #{fieldId}ORDER BY lg.LIMIT_ORDER

 

case when 的实战应用