MYSQL没用过,只用MSSQL,应该相通吧,我在MS SQL里是这样处理的: 在A库的表A里创建触发器,然后更新B库的表B 如:Create Trigger dhtest on tableA for insert as declare @im intSelect @im = count(b.mobile) From inserted a inner join databaseB.dbo.tableB b on a.OrgAddr=b.mobileIf @im=0begin Insert into databaseB.dbo.tableB(mobile) Select OrgAddr From inserted endUpdate tableA Set Reserve1=0 From tableA,inserted Where tableA.SM_ID=inserted.SM_IDGO
update db1.table1,db2.table2 set db1.table1.f1 = db2.table2.f2 where db1.table1.xx = db2.table2.xx
在A库的表A里创建触发器,然后更新B库的表B
如:Create Trigger dhtest on tableA
for insert
as
declare @im intSelect @im = count(b.mobile) From inserted a inner join databaseB.dbo.tableB b on a.OrgAddr=b.mobileIf @im=0begin
Insert into databaseB.dbo.tableB(mobile) Select OrgAddr From inserted
endUpdate tableA Set Reserve1=0 From tableA,inserted Where tableA.SM_ID=inserted.SM_IDGO
楼上正解~