有两个数据库acc1、acc2,都存有多条数据。现在想显示acc2中有但是acc1中没有的数据,而且acc2中数据可能有多条重复。同时显示在dbgrid中,如何显示?
因为是ACCESS数据库,子查询不能返回多个值。所以用
select * from acc2 where not exists (select * from acc1)。这个查询不能做到。
因为是ACCESS数据库,子查询不能返回多个值。所以用
select * from acc2 where not exists (select * from acc1)。这个查询不能做到。
然后
select * from acc2 where id not exists (select id from acc1)
2 你所说的数据是一个字段的还是所有字段的全部相同?
Microsoft OLE DB Provider for SQL Server 错误 '80040e31' 超时已过期 /Expert/reply.asp,行105
也可以用select * from acc2 where id not in(select id from acc1);
可以用select * from acc2 where not exists(select * from acc1 where acc2.field1=acc1.field1 and acc2.field2=acc1.field2);
也可以用select * from acc2 where id not in(select id from acc1);
可以用select * from acc2 where not exists(select * from acc1 where acc2.field1=acc1.field1 and acc2.field2=acc1.field2);
也可以用select * from acc2 where id not in(select id from acc1);
可以用select * from acc2 where not exists(select * from acc1 where acc2.field1=acc1.field1 and acc2.field2=acc1.field2);
也可以用select * from acc2 where id not in(select id from acc1);