select statement Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: select statement

  1. #1
    Join Date
    Oct 2000
    Hi Guys,
    Will someone help me in correcting the following query?

    select * from table_A where
    (d_num=8775816562) or
    (d_num=8005079934) or
    (c_date>='20010312193000') and
    (c_date>='20010312204000') and
    (c_date>='20010312194500') or
    (c_date>='20010312195000') and
    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


  2. #2
    Join Date
    Dec 2000
    Ljubljana, Slovenia
    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

    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')

    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width