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

Home -> Community -> Usenet -> c.d.o.tools -> Re: To write a query without using a sub query

Re: To write a query without using a sub query

From: Niall Litchfield <n-litchfield_at_audit-commission.gov.uk>
Date: Thu, 19 Jul 2001 14:41:00 +0100
Message-ID: <3b56e37c$0$3758$ed9e5944@reading.news.pipex.net>

you could try

select emp,emp_name from emp
MINUS
select supervisor_emp,supervisor_name from supervisor;

assuming the columns have the same datatypes and formats and MySQL supports set operators.

Or of course you could choose a more advanced RDBMS.

--
Niall Litchfield
Oracle DBA
Audit Commission UK

Legal disclaimer required by my employer
****************************************************************************
**
This email contains information intended for the addressee only.
 It may be confidential and may be the subject of legal and/or professional
privilege.
Any dissemination, distribution, copyright or use of this communication
without prior permission of the addressee is strictly prohibited.
****************************************************************************
**
"Prasad Kulkarni" <prasad.kulkarni_at_mailcity.com> wrote in message
news:a8274029.0107170449.241355b4_at_posting.google.com...

> Hello all,
>
> I am using a free database called 'MySql'. But unfortunately it does
> not support sub queries. Can some one help me to write the query
> without using the sub query.
> For example, my query is something like this:
>
> SELECT emp_name FROM emp
> WHERE emp_num > 0
> and emp_num NOT IN (SELECT supervisor_emp FROM supervisor).
Received on Thu Jul 19 2001 - 08:41:00 CDT

Original text of this message

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