select
*
from
CMN_FUND
where
FUND_CODE_ in
(select FUND_CODE_ from CMN_FUND minus select FUND_CODE_ from CMN_PROMOTION_FUND where FUND_CODE_ in
(select FUND_CODE_ from CMN_PROMOTION_FUND where SELLPROMOTE_CODE_ = #{promotionCode}))
and
FUNDCOMP_CODE_ = #{fundCompCode}
order by
FUND_CODE_
2、用not in来处理:
select
f.FUND_CODE_, f.SHORT_NAME
from
CMN_FUND f, CMN_PROMOTION_FUND p
where
f.FUND_CODE_ = p.FUND_CODE_
and
f.FUND_CODE_ not in (SELECT FUND_CODE_ from CMN_PROMOTION_FUND where PROMOTION_CODE = #{promotionCode})
and
f.FUNDCOMPCODE = #{fundCompCode}
包含。sql是具有数据 *** 纵和数据定义等多种功能的数据库语言,这种语言具有交互性特点,能为用户提供极大的便利,sql查询包含当月的数据,通过DATEDIFF函数计算相差时间以获取正确的过滤条件来查询。use masterselect * from sys.databases where name not in ('master','msdb','tempdb','model')
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)