Question Locked

SQL help required.

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

could someone kindly help me out with the following.

The following query works fine however i need to do the same thing only this time using an explicit join.

select Departments.Deptnumber, Departments.name,
sum (quantity)
from SalesOrderItems, Departments
where Departments.Deptnumber = SalesOrderItems.DeptNumber
group by Departments.Deptnumber, Departments.name;

I have tried

select Departments.Deptnumber, Departments.name,
sum (quantity)
from Departments INNER JOIN SalesOrderItems
ON Departments.Deptnumber = SalesOrderItems.DeptNumber
order by Departments.Deptnumber, Departments.name;

but keep getting the error
ERROR at line 3:
ORA-00933: SQL command not properly ended

any help will be apriciated thanks.

3 replies

by robo_dev

your 'order by' clause is not understood.

What version Oracle?

Joins are not supported in versions prior to 9i

by tony hopkinson

select Departments.Deptnumber, Departments.name,
sum (SalesOrderItems.Quantity)
from Departments
inner join SalesOrderItems
On Departments.Deptnumber = SalesOrderItems.DeptNumber
group by Departments.Deptnumber, Departments.name

Group By should give you the ordering as well me thinks.

This discussion is closed to new replies.