譬如,查询两次,每次产生不同和结果,我要把这些不同的结果都整齐地插入一个新表。我用如下的语句,但不好用。其中,table-1为临时表,table-2为源表,table-3结果表。
DoCmd.RunSQL "insert into table-1 field-1 fields2 select fields-21 fields-21 from table-2 where id=12 fields-21>99"
DoCmd.RunSQL "update table-3 set field-31 =(select feilds-11 from table-1) fields-32=(select fields-12 from table-1)"
DoCmd.RunSQL "delete from table-1"
DoCmd.RunSQL "insert into table-1 field-1 fields2 select fields-21 fields-21 from table-2 where id=34 fields-21>99"
DoCmd.RunSQL "update table-3 set field-33 =(select feilds-11 from table-1) fields-34=(select fields-12 from table-1)"
这段代码的目的是把源表中table-2中的满足条件的行记录转换为新表table-3中的列记录,新表table-3红的列记录标题为源表table-2的行记录。新表table-3部包含其他新数据。
请问各位大虾有什么好办法吗?
谢谢。