有两个表的结构是一样的,但内容不一样
a表
日期(rq) 货号(hh) 规格(gg) 数量(sl)
070101 10001 0 10
070102 10001 1 20
070102 10001 2 5b表
日期(rq) 货号(hh) 规格(gg) 数量(sl)
070101 10001 0 10
怎么样关联才能查出070102 10001 1 20
070102 10001 2 5
然后插入到B表中请各位帮忙解决一下,急!先谢谢了
a表
日期(rq) 货号(hh) 规格(gg) 数量(sl)
070101 10001 0 10
070102 10001 1 20
070102 10001 2 5b表
日期(rq) 货号(hh) 规格(gg) 数量(sl)
070101 10001 0 10
怎么样关联才能查出070102 10001 1 20
070102 10001 2 5
然后插入到B表中请各位帮忙解决一下,急!先谢谢了
insert into b select * from a where not exists(select * from
b where rq=a.rq )