1

我正在尝试使用事务表中的时间戳和用户表中的时间戳之间的差异来填充我的事务表上的列。这个想法是标准化日期以反映交易发生在用户体验的哪个时间点(即,在用户加入后多少天处理了交易),如下所示:

update transactions 
set days = ceil(extract(days from T.tdate - U.created_at)) +1
from transactions T join users U on T.user_id=U.id

出于某种原因,运行查询后,所有行在“天数”字段中都获得相同的数字 (262)。

4

1 回答 1

3
update transactions
set days = ceil(extract(days from tdate - U.created_at)) +1
from users U
where user_id = U.id
于 2013-08-26T23:20:32.227 回答