update tableA set sfca='有' where tableA.xm in (select tableb.xm from tableB ) 就行了
用SQL语句就可以实现。 select b.xm from a,b where a.xm=b.xm and a.sfcz='有'
update tableA set sfca = '有' from tableA A, tableB B where A.XM = B.Xm不知道那个会快一些。
update tableA set sfca='有' from tableA a,B b where a.xm=b.xm
update a set sfcz=1 from a inner join b on a.xm=b.xm
procedure TForm1.Button1Click(Sender: TObject); begin query1.Close; query1.SQL.Clear; query1.SQL.Add('update A set sfcz ="有"' ); query1.SQL.Add('from A, B '); query1.SQL.Add('where A.XM = B.Xm '); query1.prepare; query1.ExecSQL; end; 提示语法错误为操作符丢失在查询表达式[有]from A 中 不知如何修改
就行了
select b.xm
from a,b
where a.xm=b.xm and a.sfcz='有'
from tableA A, tableB B
where A.XM = B.Xm不知道那个会快一些。
from tableA a,B b
where a.xm=b.xm
begin
query1.Close;
query1.SQL.Clear;
query1.SQL.Add('update A set sfcz ="有"' );
query1.SQL.Add('from A, B ');
query1.SQL.Add('where A.XM = B.Xm ');
query1.prepare;
query1.ExecSQL;
end;
提示语法错误为操作符丢失在查询表达式[有]from A 中
不知如何修改