执行以下查询时,daily_subscriptions_stats表中的记录不会更新:
UPDATE daily_subscriptions_stats dss SET arrivals_count = da.arrivals_count
FROM daily_arrivals da
WHERE da.year = dss.year AND da.month = dss.month AND da.day = dss.day
daily_subscriptions_stats中的列如下:
consecutive_day, bigint
date, timestamp
arrivals_count, integer
departures_count, integer
year, integer
month, integer
day, integer
在daily_arrivals中以下内容:
year, integer
month, integer
day, integer
arrivals_count, integer
有谁知道查询为什么不更新记录?
谢谢!
答案 0 :(得分:2)
尝试使用:
UPDATE daily_subscriptions_stats dss SET arrivals_count =(SELECT da.arrivals_count
FROM daily_arrivals da
WHERE da.year = dss.year AND da.month = dss.month AND da.day = dss.day);