1)select * from v_file where cri_userid = 2 and customerid = 33333 and fileid not in (select infomationid from infochargehistory)
2)select * from v_file where cri_userid = 2 and customerid = 33333 and fileid in (select infomationid from infochargehistory where v_file.cri_enddate>infochargehistory.cri_enddate)
如果FILEID 满足第一个条件就查出来,满足第二个条件就查出来
2)select * from v_file where cri_userid = 2 and customerid = 33333 and fileid in (select infomationid from infochargehistory where v_file.cri_enddate>infochargehistory.cri_enddate)
如果FILEID 满足第一个条件就查出来,满足第二个条件就查出来
2)select * from v_file where cri_userid = 2 and customerid = 33333 and fileid in (select infomationid from infochargehistory where v_file.cri_enddate>infochargehistory.cri_enddate)
这两条语句都是跟FILEID 有关系的,如果FILEID 满足第一个条件就查出来,FILEID 满足第二个条件就查出来 ,都要在一句SQL语句中实现
你不是已经查出来了?
1)select * from v_file where cri_userid = 2 and customerid = 33333 and (fileid not in (select infomationid from infochargehistory)) or (fileid in (select infomationid from infochargehistory where v_file.cri_enddate>infochargehistory.cri_enddate) )
select * from v_file where cri_userid = 2 and customerid = 33333 and ((fileid not in (select infomationid from infochargehistory)) or (fileid in (select infomationid from infochargehistory where v_file.cri_enddate>infochargehistory.cri_enddate) ))
--这个意思?
select * from v_file where cri_userid = 2 and customerid = 33333 and (fileid not in (select infomationid from infochargehistory) or fileid in (select infomationid from infochargehistory where v_file.cri_enddate>infochargehistory.cri_enddate) )
select * from v_file where cri_userid = 2 and customerid = 33333 and fileid not in (select infomationid from infochargehistory)
and not exists((select * from v_file where cri_userid = 2 and customerid = 33333 and fileid in (select infomationid from infochargehistory where v_file.cri_enddate>infochargehistory.cri_enddate)) as b
Where v_file.关键字1=b.关键字1
and v_file.关键字2=b.关键字2)