我正在使用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行中只有一个唯一的值,该值将是max_count
列的sum(max_count)
的结果。max_count是我现有表格中的一列。我该怎么做? 我正在尝试使用以下代码来修改表格:ALTER TABLE test1 ADD COLUMNS (access_count1 int) set default sum(max_count);