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

Home -> Community -> Usenet -> c.d.o.misc -> Re: help with SELECT

Re: help with SELECT

From: GREGORY KNESER <gregoryk_at_futures.wharton.upenn.edu>
Date: 16 Oct 2001 23:28:23 GMT
Message-ID: <9qifqn$seg$1@netnews.upenn.edu>


Bing Du (bing-du_at_tamu.edu) wrote:
: ID grade1 grade2 grade3
: --------------------------
: 001 65 52 0
: 002 70 88 93
: 003 0 78 0
: 004 0 0 0

: How should I construct a SELECT statement to retrieve those IDs whose
: non-zero grades are all above 60? In this specific case, the expected
: result should be 002 and 003.

To restate, what you want is all IDs (select ID) from your table (from grade_table) if each column is either greater than 60 or equal to zero (where (grade1 > 60 or grade1 = 0) and (grade2 > 60 or grade2 = 0) etc.

select ID
from grade_table

where 	(grade1 > 60 or grade1 = 0)
and 	(grade2 > 60 or grade2 = 0)
and	(grade3 > 60 or grade3 = 0)

etc.

HTH,
Greg Received on Tue Oct 16 2001 - 18:28:23 CDT

Original text of this message

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