Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to Create a View on SQL

User_FZOVQMay 20 2022

So I tried to join three tables to create a view below.

CREATE VIEW v_employee

AS SELECT employees.employee_guid, employees.first_name, employees.email, employees.phone_number,MIN(employment_pay.effective_date) as HIRE_DATE

FROM EMPLOYEES

JOIN EMPLOYMENT

ON EMPLOYEES.EMPLOYEE_GUID = EMPLOYMENT.EMPLOYEE_GUID 

JOIN EMPLOYMENT_PAY

ON EMPLOYMENT.EMPLOYMENT_GUID = EMPLOYMENT_PAY.EMPLOYMENT_GUID

; 

/

However, I received this error

Error starting at line : 626 in command -
CREATE VIEW v_employee
AS SELECT employees.first_name, employees.email, employees.phone_number,MIN(employment_pay.effective_date) as HIRE_DATE
FROM EMPLOYEES
JOIN EMPLOYMENT
ON EMPLOYEES.EMPLOYEE_GUID = EMPLOYMENT.EMPLOYEE_GUID 
JOIN EMPLOYMENT_PAY
ON EMPLOYMENT.EMPLOYMENT_GUID = EMPLOYMENT_PAY.EMPLOYMENT_GUID
Error report -
ORA-00937: not a single-group group function
00937. 00000 -  "not a single-group group function"
*Cause:    
*Action:

I wonder if anyone could advise? Here is the attached of the tables
User:

User:

User:

Comments
Post Details
Added on May 20 2022
3 comments
133 views