查询入库表中的条码,且使用(NOT EXISTS)排除掉出库表中相同的条码即可
--查询成品入库表中的条码和款号/合同号/款式/颜色/尺码和库位信息
?--EXISTS判断后面的语句是否成立返回布尔值
?--NOT ?EXISTS判断后面的结果不存在的才会被当判断条件
?--SELECT 1 FROM CPCKDF WHERE TMHF=CPRKDF.TMH ?查询成品入库单里的条码号是否在出库单存在,存在返回1
?--not ?EXISTS (SELECT 1 FROM CPCKDF WHERE TMHF=CPRKDF.TMHF)查询成品入库单里的条码号是否在出库单存在,存在的就排除掉,剩下就是没有出库的条码
--查询成品入库表中的条码和款号/合同号/款式/颜色/尺码和库位信息
--EXISTS判断后面的语句是否成立返回布尔值
--NOT EXISTS判断后面的结果不存在的才会被当判断条件
--SELECT 1 FROM CPCKDF WHERE TMHF=CPRKDF.TMH 查询成品入库单里的条码号是否在出库单存在,存在返回1
--not EXISTS (SELECT 1 FROM CPCKDF WHERE TMHF=CPRKDF.TMHF)查询成品入库单里的条码号是否在出库单存在,存在的就排除掉,剩下就是没有出库的条码
Select CPRKDF.NBBHF as NBBHF, CPRKDF.HTHF as HTHF, CPRKDF.KHF as KHF, CPRKDF.KSF as KSF
, CPRKDF.POHF as POHF, CPRKDF.YSF as YSF, CPRKDF.CMF as CMF, CPRKDF.TMHF as TMHF
, CPRKDF.DWF as DWF, CPRKDF.SCSF as SCSF, CPRKDF.DJF as DJF, CPRKDF.KWF as KWF
, CPRKDF.CPFL as CPFL, CPRKDF.SLF as SLF, CPRKDH.CKMC as CKMC
From CPRKDH
inner join CPRKDF on CPRKDH.DjLsh=CPRKDF.DjLsh
WHERE CKMC LIKE '%仓库%' AND not EXISTS (SELECT 1 FROM CPCKDF WHERE TMHF=CPRKDF.TMHF)