table
uid id name age
1 1 kaka 34
2 1 lala 38table2
id worktime
1 2010-02-08 12:22:31
2 2008-06-26 05:14:48由table2的worktime时间判断,如果worktime的时间晚于当前时间now(),则根据table的uid来把table表的age加1
已知table的uid 进行更新操作,比如update table set age=age+1 where uid=1 and (由uid关联到本表id,在关联到tabel2的worktime,判断是不是大于now(),比当前时间晚,就更新)
这个操作是分成两步的,因为对sql不是很熟悉,如果我分成两部分来操作,性能降低的不会太多把
(已知table的uid和id)
比如先判断 table2 的时间是不是晚于now(); select id from table2 where id=1 and worktime>now();
晚于的话,然后在操作下 update table set age=age+1 where uid=1
uid id name age
1 1 kaka 34
2 1 lala 38table2
id worktime
1 2010-02-08 12:22:31
2 2008-06-26 05:14:48由table2的worktime时间判断,如果worktime的时间晚于当前时间now(),则根据table的uid来把table表的age加1
已知table的uid 进行更新操作,比如update table set age=age+1 where uid=1 and (由uid关联到本表id,在关联到tabel2的worktime,判断是不是大于now(),比当前时间晚,就更新)
这个操作是分成两步的,因为对sql不是很熟悉,如果我分成两部分来操作,性能降低的不会太多把
(已知table的uid和id)
比如先判断 table2 的时间是不是晚于now(); select id from table2 where id=1 and worktime>now();
晚于的话,然后在操作下 update table set age=age+1 where uid=1
set a.age=a.age+1
where a.uid=b.id and b.worktime>now() and b.id=1
set age=age+1
where table2.worktime>now() and table2id=1