Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: To write a query without using a sub query
Hello!
Prasad Kulkarni <prasad.kulkarni_at_mailcity.com> ñîîáùèë â íîâîñòÿõ
ñëåäóþùåå:a8274029.0107172033.7227ed47_at_posting.google.com...
> "Gerard Lapidario" <ghed9_at_netzero.net> wrote in message
news:<1R157.51$K42.658_at_burlma1-snr2>...
> > "Yaroslav Perventsev" <p_yaroslav_at_cnt.ru> wrote in message
> > news:9j1cps$cnd$1_at_news247.cnt.ru...
> > > Hello!
> > >
> > > Try this:
> > >
> > > SELECT a.emp_name FROM emp a, supervisor b
> > > WHERE a.emp_num > 0
> > > and a.emp_num!=b.supervisor_emp
> > >
> > > Best regards!
> > > Yaroslav.
> > >
> >
> > This would not return the desired result (everytime
> > a.emp_num!=b.supervisor_emp is true, emp_name will be returned).
Sorry!
I was in a hurry.
This select will work if table connect by foreign key.
SELECT a.emp_name FROM emp a, supervisor b
WHERE a.emp_num > 0 and a.ID=b.ID
and a.emp_num!=b.supervisor_emp
But It's not your choice.
Yaroslav.
> >
> > > Prasad Kulkarni <prasad.kulkarni_at_mailcity.com> ñîîáùèë â íîâîñòÿõ
> > > ñëåäóþùåå: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).
> > >
> > >
>
> Yes you are correct. The query does not return the desired results
Received on Wed Jul 18 2001 - 01:44:14 CDT
![]() |
![]() |