我正在 HIVE 中编写代码来创建一个包含 1300 行和 6 列的表:
create table test1 as SELECT cd_screen_function,
SUM(access_count) AS max_count,
MIN(response_time_min) as response_time_min,
AVG(response_time_avg) as response_time_avg,
MAX(response_time_max) as response_time_max,
SUM(response_time_tot) as response_time_tot,
COUNT(*) as row_count
FROM sheet WHERE ts_update BETWEEN unix_timestamp('2012-11-01 00:00:00') AND
unix_timestamp('2012-11-30 00:00:00') and cd_office = '016'
GROUP BY cd_screen_function ORDER BY max_count DESC, cd_screen_function;
现在我想添加另一列,access_count1
其中包含所有 1300 行的一个唯一值,值将是sum(max_count)
. max_count 是我现有表中的一列。我怎么能这样做?我正在尝试通过此代码更改表格ALTER TABLE test1 ADD COLUMNS (access_count1 int) set default sum(max_count);