求sql
有两个表t_a(aid,bid,status) t_b(bid,status,type)
如果t_b表中type=1,则status=In,
t_b=0,则status=Out,
t_b表中status更改糊同时更新t_a中的status
------解决方案-------------------- 是不是会有类似的语句更新t_b表?
UPDATE t_b SET status = (CASE type when 1 THEN 'in' WHEN 0 THEN 'Out' ELSE status END)
如果是,则用这条语句做同步,前提是t_a.bid = t_b.bid:
UPDATE t_a
SET status = (SELECT status FROM t_b WHERE t_b.bid = t_a.bid)