把这个表定义成A表。:
同一个表,同一个字段。matid中的数据不一样。可以区分。
怎同步
在date1下有四条数据,两条有数据,两条没有数据。
想把有数据的那两个同步到没有数据的上面。
写个触发器咯,想怎么同步就怎么同步
update A a1, (select * from A where date1 is not null limit 1) a2 set a1.date1 = p2.date1
where a1.date1 is null;
大概思路 没运行不知道语法有没有问题
Sql Server?
update A set Date1 = (select top 1 Date1 from A where Date1 is not null )
where Date1 is null
这样所有空的Date1都更新成是一样的