如何解决多月份工资库合并汇总的问题
我有由excel导入并生成的2006年1~6月份的6个dbf表。表格式为 单位,职工代码,姓名,应发工资。现要求将这6个表按姓名进行1~6月份的工资库合并及汇总。还望大侠们能出手相救。我是黔驴技穷了。我的QQ44409892再补充一下。这六个月的库记录是不一样的。1月库938人,2月库1125人。。。6月库1241人。如今想生成1-6月汇总库,并有工资汇总,且包括这六个月库里的每个人,并显示各月工资及6个月的工资合计。总终生成的汇总库格式为:单位,职工代码,姓名,1月工资,2月工资,3月工资,4月工资,5月工资,6月工资,1-6月工资合计。我分别试着用APPE FROM和join两种命令解决。但未能如愿。如今脑袋都成浆糊了。还望大侠出手相助!!QQ44409892
我刚试一下,以下方法可行:
t1-t6为1-6月表,结构为:bh,gz
sele bh,gz as gz1,0 as gz2,0 as gz3,0 as gz4,0 as gz5,0 as gz6 from t1 union ;
sele bh,0 as gz1,gz as gz2,0 as gz3,0 as gz4,0 as gz5,0 as gz6 from t2 union ;
...
sele bh,0 as gz1,0 as gz2,0 as gz3,0 as gz4,0 as gz5,gz as gz6 from t6 into cursor tmp1
sele bh,sum(gz1),...,sum(gz6) from tmp1 group by bh into table tt
有谁能指教一下,为何我在交互方式下输入这条命令:
"sele bh,gz as gz1,0 as gz2,0 as gz3,0 as gz4,0 as gz5,0 as gz6 from t1 union "
总是提示“语法错误”,去掉“UNION”语句执行,但无法达到目的