Path: utzoo!attcan!uunet!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!mips!dimacs.rutgers.edu!rutgers!mit-eddie!bloom-beacon!eru!hagbard!sunic!mcsun!hp4nl!philapd!idcapd!radstaat From: radstaat@idca.tds.PHILIPS.nl (Christina Radstaat) Newsgroups: comp.databases Subject: Re: SQL Question Keywords: SQL Message-ID: <910@idcapd.idca.tds.philips.nl> Date: 5 Oct 90 12:06:17 GMT References: <391@ulticorp.UUCP> Organization: Philips Information Systems, Apeldoorn, The Netherlands Lines: 27 In article <391@ulticorp.UUCP> mikei@ulticorp.UUCP (mikei) writes: >Greetings, > >Perhaps there is an SQL guru out there who can be of some assistance. >Note I am using GUPTA's SQLBase. > >Given a table of patients PID int WEIGHT int >where one PID may have numerous weight readings. > >How would I select the PID for only those patients whose >weight was ALWAYS <= 100. > If you can use subqueries in a select, the following would give you the right answer: select unique PID from patients where WEIGHT <= 100 and PID not in ( select PID from patients where WEIGHT > 100 ) -- ------------------------------------------------------------------------------- # Christina Radstaat PAV/V2-A12/13 Philips IS Apeldoorn (NL) +31 55 432824 # # domain: radstaat@idca.tds.philips.nl uucp: ...!mcvax!philapd!radstaat # -------------------------------------------------------------------------------