我有两张桌子
boxes
id, name, width, height, is_changed
1, ben, 10, 12, false
2, carol, 13, 10, false
3, david, 2, 33, false
4, ellen, 9, 17, false
boxes_new
id, name, width, height
1, ben, 1000, 12
2, xavier, 13, 10
3, david, 2, 33
4, ellen, 9, 17
请注意,box_new
中的方框1和2不同我想做点什么
UPDATE boxes SET is_changed=true WHERE boxes.name != boxes_new.is_name OR boxes.width != boxes_new.width
此外,如果出于性能原因,这些表将有数十万行。
答案 0 :(得分:1)
假设id
匹配两个框:
update boxes b
set is_changed = true
from boxes_new bn
where bn.id = b.id and
(b.name <> bn.name or
b.width <> bn.width or
b.height <> bn.height
);
答案 1 :(得分:0)
I think some nested query like this, could help,
UPDATE框SET is_changed = true WHERE id NOT IN(SELECT b.id FROM boxes b INNER JOIN boxes_new bn ON(bname = bn.name AND b.width = bn.width));
答案 2 :(得分:0)
如果可以使用NULL值,为了涵盖所有可能性,您必须使用NULL-safe comparison:
public class Parent {
private var childClass:ClassName;
private function bindSignal() {
childClass.signal.add(signalListener);
}
private function signalListener(classReference:ClassName, foo:String) {
/* do your stuff with classReference */
}
}