Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

On the order by line, I get an error saying that it's missing a right parenthesis, but I have no idea why.

SELECT LAST_NAME AS "Last Name", DEPARTMENT_ID AS "Department Id", SALARY AS 
Salary
FROM EMPLOYEES JOIN DEPARTMENTS
USING(DEPARTMENT_ID)
WHERE SALARY IN (SELECT MIN(SALARY)
            FROM EMPLOYEES
            GROUP BY DEPARTMENT_ID, SALARY
            ORDER BY DEPARTMENT_ID);
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
2.1k views
Welcome To Ask or Share your Answers For Others

1 Answer

order by is not allowed in a subquery used on the right-hand side of an in condition. Oracle expected the closing parenthesis before order by.

It makes no sense to order the results of a subquery used in the in conditions.

Besides that, you probably want to group by dept_id only (why also by salary? that makes no sense).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...