一、有如下两个表:
table1 table2
bh xm zh je bh xm zh je
1 aa 123 50.00 1 aa 256 60.00
2 bb 565 100.00 2 cd 558 120.00
3 cc 2322 20.00 5 gg 596 50.00
要将两个表进行合并,合并后要求如下:
bh xm zh je
1 aa 123 110.00
2 bb 565 220.00
3 cc 2322 20.00
5 gg 596 50.00
即按编号(bh)合并,编号不同的全都加到新表中,
编号相同的金额(je)相加,其他字段的内容沿用table1的内容二、
delete from table_name where confitipns
为何执行后老出错
请各位大侠指教,谢谢!!!!!
table1 table2
bh xm zh je bh xm zh je
1 aa 123 50.00 1 aa 256 60.00
2 bb 565 100.00 2 cd 558 120.00
3 cc 2322 20.00 5 gg 596 50.00
要将两个表进行合并,合并后要求如下:
bh xm zh je
1 aa 123 110.00
2 bb 565 220.00
3 cc 2322 20.00
5 gg 596 50.00
即按编号(bh)合并,编号不同的全都加到新表中,
编号相同的金额(je)相加,其他字段的内容沿用table1的内容二、
delete from table_name where confitipns
为何执行后老出错
请各位大侠指教,谢谢!!!!!
解决方案 »
- DLL 的 ExitCode ??
- 如何把一个用GetMem方法得到数据,使用数组的方式进行防问?
- 紧急呼救!关于报表打印,提供有价值线索者,另加50分,谢谢各位
- 怎么赋一个null值呢?Data.ADOQQuery.FieldByName('countby').AsInteger := Null不行?
- 简单的文本显示问题,解决结帖
- Delphi6.0程序如何制作安装盘
- 知道IP如何知道计算机名???
- 100分,如何调用windows附件的计算器
- Delphi中有关Tcombox控件的问题~
- Tedit 怎样设定只接受数字
- 请问如何使一个数据库的数据记录数量可被某个整数整除呢?
- 如何将Access中的数据表导成Excel格式?
while not table1.eof do
begin
确定table2中与table1.bh相同记录之je并相加;
插入table3;
table1.next;
end;2 问题写的不清楚
我用query.sql可以执行相同编号的金额相加,但不相同的无法追加;
select * from table1,table2 where table1.bh=table2.bh
order by table1.bh and table2.bh
然后执行金额相加;接着追加编号不同的记录;
.........
select * from table1,table2 where table1.bh<>table2.bh
order by table1.bh and table2.bh
然而条件where table1.bh<>table2.bh 不能进行精确查找
我测试的表只有两条记录不同,但结果有20多条,大部分都重复
条件where table1.bh<>table2.bh 语句有问题吗?请指教!