查询数据表,去除符合某些条件的记录,没有自动增长列(not exists)

 select distinct ccode,isnull(cexch_name,''),N'',N'',N'2014.03',0,1,1,1,12 from RP_bankrecp

    where not exists(

    select distinct r.ccode,isnull(r.cexch_name,'')

    from RP_bankrecp  r inner join gl_bankalert g on r.ccode=g.ccode and isnull(r.cexch_name,'')= isnull(g.cexch_name,'')

    where iyear=2014

    )

 

这样是错误的,not exists 只是返回是否有结果集,相当于一个true or false的值

posted @ 2014-03-24 12:07  银杏叶儿  Views(150)  Comments(0Edit  收藏  举报