两个表格一样的格式将两表数据合并,我用UNION不能包含所有数据呢
合并后数据咋不全呢
SELECT smxdl.编码, smxdl.名称, smxdl.规格, smxdl.单位, smxdl.单价, smxdl.数量 FROM smxdl
UNION
SELECT putoutdl.编码, putoutdl.名称, putoutdl.规格, putoutdl.单位, putoutdl.单价, putoutdl.数量 FROM putoutdl;
其中一个表的数据都有14条,,合并后的数据才13条...
合并后数据咋不全呢
SELECT smxdl.编码, smxdl.名称, smxdl.规格, smxdl.单位, smxdl.单价, smxdl.数量 FROM smxdl
UNION
SELECT putoutdl.编码, putoutdl.名称, putoutdl.规格, putoutdl.单位, putoutdl.单价, putoutdl.数量 FROM putoutdl;
其中一个表的数据都有14条,,合并后的数据才13条...
UNION 会自动排序,UNION ALL则不会,所以说用UNION ALL效率高
LZ换UNION ALL 试验一下
换union all