Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Subquery on SELECT clause

Re: Subquery on SELECT clause

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Mon, 30 Nov 1998 20:20:00 GMT
Message-ID: <3668fdbc.22884786@192.86.155.100>


A copy of this was sent to "John Chaves" <john.chaves_at_us.pwcglobal.com> (if that email address didn't require changing) On Mon, 30 Nov 1998 15:05:54 -0000, you wrote:

>I am trying to retrieve a description value from a table while querying
>another but I can't get the SQL text
>right. For example, I need the order_id and the employee name instead of its
>id.
>
>SELECT order_id,
>(SELECT emp_name FROM Employees WHERE Employees.emp_id = Orders.emp_id) AS
>"Name"
>FROM Orders
>WHERE order_Item = 'soap'
>
>The SQL works fine in SQL Server or Access, with minor modifications.
>

this would simply be:

select order_id, emp_name "Name"
from orders, employees
where employees.emp_id = orders.emp_id
and order_item = 'soap'

>Can you help ?
>
>john.chaves_at_us.pwcglobal.com
>
>Thanks
>
 

Thomas Kyte
tkyte_at_us.oracle.com
Oracle Government
Herndon VA

--
http://govt.us.oracle.com/ -- downloadable utilities  



Opinions are mine and do not necessarily reflect those of Oracle Corporation  

Anti-Anti Spam Msg: if you want an answer emailed to you, you have to make it easy to get email to you. Any bounced email will be treated the same way i treat SPAM-- I delete it. Received on Mon Nov 30 1998 - 14:20:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US