Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: help with SELECT
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)
HTH,
Greg
Received on Tue Oct 16 2001 - 18:28:23 CDT
![]() |
![]() |