剔除满足两个条件的数据

促销终稿界面汇总时剔除

执行机构包含PH01且商品u课等级大于U01的商品

SELECT * FROM #LS_P_ZPROMOTION_DOC_ITEMS a        WHERE NOT EXISTS( SELECT * FROM #LS_P_ZPROMOTION_DOC_ITEMS b             where a.Display1=b.Display1              and b.CLASS LIKE ''%PH01%''              and ( ISNUMERIC(CAST(SUBSTRING(asort,7,2) AS INT))=1 AND CAST(SUBSTRING(asort,7,2) AS INT)>1 )              )

posted @ 2016-04-18 17:10  Carri  阅读(497)  评论(0编辑  收藏  举报