当前位置:主页>销售管理软件> 列表

关于一个SQL的问题!

仓库管理软件版1楼: 有两张表:A,B
A表(出库表)有:
编号 登记日期 数量 经办人
1 10月1日 10 张三
2 10月2日 40 李四
3 10月3日 20 王五
4 10月4日 70 李二
B表(物品名称表)有:
编号 名称
1 苹果
2 桔子
3 梨子
4 花生
5 桃子
6 面包
求10月1日到10月4日未产生出库的物品名称有那些?SQL语句怎么写?

2楼: select * from 物品名称表 where not exists (select * from 出库表 where 编号=物品名称表.编号)
这条语句是取没有在A表中出现的物品,在内层select中再处理一下日期,应该可以吧,太晚了,明天试试,睡觉啦~~~~~~~~ 如服装生产管理软件

3楼: select * from 物品名称表 where not exists (select * from 出库表 where 编号=物品名称表.编号 and 登记日期 between ''2005-10-01'' and ''2005-10-4'')
我试了好像可能哦~~

4楼: SELECT * FROM B WHERE B.编号 NOT IN (SELECT 编号 FROM A WHERE 登记日期 between ''2005-10-01'' and ''2005-10-4'')

5楼: select 名称
from b
where 编号 not in(
select 编号
from a
where 登记日期 between ''2005-10-1'' and ''2005-10-4'')

6楼: select * from b where not exists( select * from a where a.no=b.no and a.rq between ''2005-10-01'' and ''2005-10-04'')

仓库管理软件版7楼: 非常感谢各位!

8楼: 多人接受答案了。



上一篇:sql语句问题~~~   下一篇:DBGRID能不能打印?