0
votes

I'm working on some SQL developer queries and I keep getting this error. Ive looked online but I cant see to see why my syntax bring a "SQL command not properly ended error". The error is showing up on the line that has "FROM lgemployee as e". Any help in the right direction would be greatly appreciated.

SELECT e.emp_num, emp_lname, emp_fname, sal_amount
FROM lgemployee as e
NATURAL JOIN lgsalary_history
WHERE sal_from = (SELECT min(sal_from))
FROM lgsalary_history as s2
WHERE (e.emp_num = s2.emp_num)
ORDER BY e.emp_num;
2

2 Answers

1
votes

You can't use as as alias for tables, only in select statements, for instance:

select column as "alias"
from table a

Remove the as from your table declarations. It should run fine.

0
votes

I think it's just wrong parentheses nesting -- try

SELECT e.emp_num, emp_lname, emp_fname, sal_amount
FROM lgemployee as e
NATURAL JOIN lgsalary_history
WHERE sal_from = (SELECT min(sal_from)
FROM lgsalary_history as s2
WHERE (e.emp_num = s2.emp_num))
ORDER BY e.emp_num;