各位老师,两个表的结构一样,表t1,表t2 都有字段"学号".
怎样用一条sql 语句,把 t2 中与t1 不同学号的记录插入到t1中
我用了这个语句
ADoquery1.SQL.Add('insert into stuinfo select * from zstuinfo a where (stuinfo.学号<>a.学号)');
系统提示:
stuinfo 别名有错.如何设定 stuinfo 的别名呢?
怎样用一条sql 语句,把 t2 中与t1 不同学号的记录插入到t1中
我用了这个语句
ADoquery1.SQL.Add('insert into stuinfo select * from zstuinfo a where (stuinfo.学号<>a.学号)');
系统提示:
stuinfo 别名有错.如何设定 stuinfo 的别名呢?
insert into t1 select * from t2 where t2.学号 not in (select 序号 from t1)
ADoquery1.SQL.Add('insert into t1 select * from t2 where t2.學号 not in (select 學号 from t1)');
ADoquery1.SQL.Exec;