我需要创建一个视图: 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
答案 0 :(得分: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)
我自己得到了答案,如果有人遇到这种情况,请参考。