insert into goods(类别,编码,名称,规格,单位,入价,出价,备注)'+
' select 类别,编码,名称,规格,单位,入价,出价,备注 from [Excel 8.0 database='+xlspath+']'+
'.[sheet1$] where 编码 not in(select 编码 from goods)'xlspath:=Opendialog1.FileName;
' select 类别,编码,名称,规格,单位,入价,出价,备注 from [Excel 8.0 database='+xlspath+']'+
'.[sheet1$] where 编码 not in(select 编码 from goods)'xlspath:=Opendialog1.FileName;
2.not in后加空格
3.where 编码 not in(select 编码 from goods)中编码字段是哪个表的,如果是xlspath中的,那goods也该加上[]里的东西,当然建议起个别名
我想把一个EXCEL表里的数据更新到一个GOODs表中,,,条件是EXCEL表中的数据在GOODS中是没有的.
咋整呢
除了中文加上引号外,“from [Excel 8.0 database=...”,Excel 8.0后面是不是有个分号;用Access数据库测试了一下,下面这句是可以的。但通过Delphi代码使用OLEDB/ODBC也可能写法有点区别SELECT "类别", "编码", "备注" FROM [Excel 8.0; database=c:\1.xls].[sheet1$]