How to make SQL sub query work in Oracle, getting error ?
How to make SQL sub query work in Oracle, getting error ?
(OP)
Hi,
Trying to find out whether below SQL Server - SQL style works in oracle.
On testing SQL in Oracle, it gave Error: Ora-00923 from keyword not found where expected
Is there another way to run above Oracle sql query as Subquery similar to SQL Server SQL?
Please help.
Ken
Trying to find out whether below SQL Server - SQL style works in oracle.
On testing SQL in Oracle, it gave Error: Ora-00923 from keyword not found where expected
CODE
SQL Server code: Select aid, sum(amount) from ( Select t.aid, t.isbn, amt = (t.price * r.royalty) from table as t inner join table2 as r on t.isbn=r.isbn left join table3 as s on t.isbn=s.isbn ) as A Group by aid
CODE
Oracle Code with eror: Select DEPTNO, sum(sal), sum(IN_amt) from ( Select e.DeptNO, e.sal as sal, IN_amt = (e.sal * .1) from emp as e ) as A Group by Deptno
Please help.
Ken
RE: How to make SQL sub query work in Oracle, getting error ?
CODE
And i'm not sure (as I never do it that way) that oracle supports the "int_amt = ..."
you may need to use "(e.sal * .1) as IN_amt" instead
Regards
Frederico Fonseca
SysSoft Integrated Ltd
www.syssoft-int.com
FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?
RE: How to make SQL sub query work in Oracle, getting error ?
Oracle allows "as" to define a table alias but does not allow the SQL server style column alias using the equal sign ( IN_amt = (e.sql * .1) ).
Another way to run the query that works on Oracle and SQL Server, but with different syntax is the with clause.
This is the Oracle syntax:
CODE
RE: How to make SQL sub query work in Oracle, getting error ?
Thank you for the follow up, SQL works when using 'as' instead of equal sign in Oracle.
CODE
Thanks,
Ken
RE: How to make SQL sub query work in Oracle, getting error ?
CODE
Bill
Lead Application Developer
New York State, USA