2017-08-30 3 views
-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 

ビューの列のデータは、単一の列から来ていますテーブルは異なるが条件は異なる。私はビューを作成する必要があります。助けてください、テーブルは以下に記載されています。

テーブル名:従業員

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

答えて

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) 

私は答えを自分で持って、誰もがこのような状況に実行する場合、これを参照してください。