私は2つの日付フィールドを持っています。1 つは完全に動作し ( created )、2 番目 ( transactiontime ) はわずかに遅れます。したがって、作成した日付を UNIX 時間で使用し、from_unixtime を使用して変換し、それをフィールド (transactiontime) に設定したいと考えています。
transactionsid created transactiontime
1 1362140510 2013-06-06 16:55:21
2 1362501952 1980-02-01 13:25:52
3 1362502022 1980-02-02 14:20:10
3 1364224671 0
and so on, and so on
これが私が試した方法です。しかし、t3を定義できないため、これは機能しません。なぜこれが起こっているのですか? もっと簡単な方法はありますか?
UPDATE transactions as t1
set t1.transactiontime =
(
select FROM_UNIXTIME(t2.created)
from transactions as t2
where t2.transactiontime < '2011-01-01 00:00:00'
) as t3
where t1.transactionid = t3.transactionid