当
SELECT * from hospital_basic
LEFT JOIN hospital_clinical on hospital_basic.p_id=hospital_clinical.p_id;
它工作正常,但在创建视图时出现错误
CREATE VIEW hospital_view AS
SELECT * from hospital_basic LEFT JOIN
hospital_clinical on hospital_basic.p_id=hospital_clinical.p_id;
您需要为您选择的列添加别名,但您不能这样做
select *
,因为列 p_id 将在表定义中重复
CREATE VIEW hospital_view AS
SELECT
hospital_basic.p_id as hospital_basic_p_id,
hospital_clinical.p_id as hospital_clinical_p_id,
other columns ...
from hospital_basic LEFT JOIN hospital_clinical on hospital_basic.p_id=hospital_clinical.p_id;
请帮我解决这个问题
hive> 创建表示例
> AS
> SELECT a.stock_symbol, b.stock_symbol, Month(a.stock_date), (AVG(a.stock_price_high*b.stock_price_high)-(AVG(a.stock_price_high)*AVG(b.stock_price_high))) FROM nyse a JOIN nyse b ON (a.stock_date=b.stock_date) WHERE a.stock_symbol
失败:SemanticException [错误 10036]:重复的列名称:stock_symbol