Re: Is this a bug or a limitation of the SQL language

From: Bill Winett <no email>
Date: 25 Aug 92 18:52:29 GMT
Message-ID: <29764_at_goofy.Apple.COM>


In article <1992Aug23.074048.16681_at_prism.poly.edu>, sjha_at_prism.poly.edu (Salil Kumar Jha) writes:
>
> I tried to do this query in Oracle and DB2 and both failed. I know its
> not allowed but why not?
>
> Assume the use of the classic oracle emp table
>
> select * from emp
> where salary between
> (select salary from emp where ename = 'Larry')
> and
> (select salary from emp where ename = 'John')
>
> Isnt this the best way of finding all people whose salaries lie between those
> of Larry and John (without knowing whose is larger)
>
> sjha_at_prism.poly.edu
>
No, it isn't the best way. Here's how you can do what you want:

select * from emp
where salary in (select salary from emp where ename between 'John' and 'Larry'); Received on Tue Aug 25 1992 - 20:52:29 CEST

Original text of this message