两个数据表a和b,均包含字段“编号 名称 数量 时间”,如何查询b表中存在的编号而在a表中不存在,且b.时间在2010-1-1至2010-1-20时间段,以下语句如何修改或该sql语句如何写?
select * from b where not exists(select 1 from a where a.编号=b.编号)
select * from b where not exists(select 1 from a where a.编号=b.编号)
from b
where not exists(select 1 from a where a.编号=b.编号)
and convert(varchar(10),b.时间,120) between '2010-01-01' and '2010-01-20'