-
Hi Guys,
Will someone help me in correcting the following query?
select * from table_A where
(
(d_num=8775816562) or
(d_num=8005079934) or
(d_num=8005001234)
)
and
(
(c_date>='20010312193000') and
(c_date>='20010312193030')or
(c_date>='20010312204000') and
(c_date>='20010312194500') or
(c_date>='20010312195000') and
(c_date>='20010312195000')
)
order by d_number
I want to select all rows from table_A where d_num is one of the given 3 and for the period between one of the 3 ranges of c_date. c_date is a varchar2
Thanks
manjunath
-
For an interval, you should use "less-then-or-equal" operator for the upper limit ;)...
Change your interval conditions to:
(c_date>='20010312193000') and
(c_date<='20010312193030') or
(c_date>='20010312204000') and
(c_date<='20010312194500') or
(c_date>='20010312195000') and
(c_date<='20010312195000')
Or amybe to more readable form:
(c_date BETWWEN '20010312193000' and '20010312193030' or
c_date BETWWEN '20010312204000' and '20010312194500' or
c_date BETWWEN '20010312195000' and '20010312195000')
HTH,