Home » SQL & PL/SQL » SQL & PL/SQL » having doubt with USING clause in JOINS (Oracle 10G, 10.2.0, Windows XP with SP2)
having doubt with USING clause in JOINS [message #342637] Sat, 23 August 2008 08:41 Go to next message
ssatyan.129
Messages: 4
Registered: August 2008
Location: Chennai
Junior Member
Dear Friends,
Below I pasted a query that throws an error
select last_name, job_id, department_id, department_name
from employees join departments using ( department_id ) 
join locations using ( location_id ) and locations.city = 'Toronto';

join locations using ( location_id ) and locations.city = 'Toronto'
*
ORA-00933: SQL command not properly ended

my doubt is can I use AND condition with USING clause is used?

[mod-edit] color, size and font removed. too hard to read.

[Updated on: Mon, 25 August 2008 08:10] by Moderator

Report message to a moderator

Re: having doubt with USING clause in JOINS [message #342639 is a reply to message #342637] Sat, 23 August 2008 09:00 Go to previous messageGo to next message
flyboy
Messages: 1832
Registered: November 2006
Senior Member
First of all, this is syntax error, so you shall consult the documentation, found e.g. online on http://tahiti.oracle.com/

SQL Reference
Chapter 19: SQL Statements
SELECT

Note, that USING is the part of join_clause, however filtering condition(s) shall be placed into where_clause (starts with the WHERE reserved word).
icon14.gif  Re: having doubt with USING clause in JOINS [message #342676 is a reply to message #342637] Sun, 24 August 2008 00:25 Go to previous message
ssatyan.129
Messages: 4
Registered: August 2008
Location: Chennai
Junior Member
Dear Flyboy,

Thanks a lot for your reply. Today morning I corrected the syntax error. The query executed successfully by replacing the AND with the WHERE clause.

Previous Topic: Fetching middle rows from the database
Next Topic: last row from a query result
Goto Forum:
  


Current Time: Fri Dec 09 21:16:54 CST 2016

Total time taken to generate the page: 0.09675 seconds