1

所以我创建了一个视图,并希望用新名称显示视图的新列,例如:

CREATE VIEW monthly_view AS
(SELECT co.object_id, co.object_alias, cm.method_alias, dr.data_value,
           cd.data_uom, dr.date_timestamp, dr.delay_value, dr.delay_pct
FROM data_realtime AS dr
JOIN chroniker_object AS co ON co.object_id=dr.object_id
JOIN chroniker_data AS cd ON cd.data_id=dr.data_id
JOIN chroniker_method AS cm ON cm.method_id=co.method_id)

我想要的是每当显示“monthly_view”时,“co.object_id”可以显示为“对象”。

谢谢

4

3 回答 3

2

您可以使用别名:

CREATE VIEW monthly_view AS
SELECT co.object_id AS Object,
       co.object_alias AS ...,
       cm.method_alias AS ...,
       ...
FROM
       ...
于 2013-05-10T23:15:04.580 回答
0
select co.object_id AS object, ....
于 2013-05-10T23:15:05.587 回答
0

您是否尝试过在 select 语句中提供别名?

CREATE VIEW monthly_view AS
(SELECT co.object_id AS Object, 
        co.object_alias AS ObjectAlias, 
        ....
FROM data_realtime AS dr
JOIN chroniker_object AS co ON co.object_id=dr.object_id
JOIN chroniker_data AS cd ON cd.data_id=dr.data_id
JOIN chroniker_method AS cm ON cm.method_id=co.method_id)
于 2013-05-10T23:15:28.703 回答