-1

我需要创建一个视图:employee_view

CREATE VIEW employee_view (Name_of_employee, Name_of_PL, Name_of_manager)
AS 
(
Need help here!
)

Raj is an employe
Vijay is a PL
Kumar is a manager

视图列的数据来自表的单个列,但具有不同的 where 条件。我需要创建一个视图。请帮忙,下面提到了表格。

表名:员工

compid secid rowid fieldname
22      1    6     Raj
22      2    7     Vijay
22      3    8     Kumar
4

1 回答 1

0
CREATE VIEW employee_view (Name_of_employee, Name_of_PL, Name_of_manager)
AS 
SELECT
(select fieldname from employee where secid=1 and rowid=6),
(select fieldname from employee where secid=2 and rowid=7),
(select fieldname from employee where secid=3 and rowid=8)

我自己得到了答案,如果有人遇到这种情况,请参考这个。

于 2017-08-30T08:25:05.520 回答