Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: help with multiple BETWEEN statements
This is incorrect in that it ignores the initial condion:
where rate = 'abc'
This should apply to the rest of the conditionals appended to it.
A correct solution would be:
SELECT A from table1 where rate = 'abc' and (code between '0100' and '0199' or code between '4000' and '4499' or code between '7000' and '7999' or code between '9000' and '9499');
This enforces the conditions as expected, and allows for multiple ranges for the code column.
David Fitzjarrell
noodles_at_aol.com (Noodles) wrote in message news:<20030112185012.21504.00000430_at_mb-fm.aol.com>...
> I think you mean the following:
>
> SELECT A from table1
> where rate = 'abc'
> or code between '0100' and '0199'
> or code between '4000' and '4499'
> or code between '7000' and '7999'
> or code between '9000' and '9499';
>
> Xho is correct in the fact that you can't stisfy mutually exclusive conditions.
>
> Cliff
Received on Mon Jan 13 2003 - 11:02:47 CST