home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / database / 6342 < prev    next >
Encoding:
Internet Message Format  |  1992-08-26  |  1.3 KB

  1. Xref: sparky comp.databases:6342 comp.databases.theory:398 comp.databases.oracle:1381
  2. Path: sparky!uunet!haven.umd.edu!darwin.sura.net!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!ames!data.nas.nasa.gov!taligent!apple!
  3. From:  (Bill Winett)
  4. Newsgroups: comp.databases,comp.databases.theory,comp.databases.oracle
  5. Subject: Re: Is this a bug or a limitation of the SQL language
  6. Message-ID: <29764@goofy.Apple.COM>
  7. Date: 25 Aug 92 18:52:29 GMT
  8. References: <1992Aug23.074048.16681@prism.poly.edu>
  9. Sender: usenet@Apple.COM
  10. Organization: Apple
  11. Lines: 22
  12.  
  13. In article <1992Aug23.074048.16681@prism.poly.edu>, sjha@prism.poly.edu (Salil Kumar Jha) writes:
  14. > I tried to do this query in Oracle and DB2 and both failed. I know its
  15. > not allowed but why not?
  16. > Assume the use of the classic oracle emp table
  17. > select * from emp 
  18. > where salary between
  19. > (select salary from emp where ename = 'Larry')
  20. > and
  21. > (select salary from emp where ename = 'John')
  22. > Isnt this the best way of finding all people whose salaries lie between those
  23. > of Larry and John (without knowing whose is larger)
  24. > sjha@prism.poly.edu
  25. No, it isn't the best way.  Here's how you can do what you want:
  26.  
  27. select * from emp
  28. where salary in (select salary from emp where ename between 'John' and 'Larry');
  29.