AND has precendence over OR, so your "where" criteria are being evaluated
like this:

   where cond1 OR (cond2 AND cond3)

In your case, "cond1" is for the messages of severity 'E', so those are
displayed regardless of the date.

Put parentheses around the ORed conditions to fix the problem:

   where (cond1 OR cond2) AND cond3

i.e.

   select date_time, msgno, message
      from actlog
      where (severity='E' or severity='W')
      and date_time>(current_timestamp-(1 day))

Andy Raibeck
IBM Software Group
Tivoli Storage Manager Client Development
Internal Notes e-mail: Andrew Raibeck/Tucson/[EMAIL PROTECTED]
Internet e-mail: [EMAIL PROTECTED]

The only dumb question is the one that goes unasked.
The command line is your friend.
"Good enough" is the enemy of excellence.




Joni Moyer <[EMAIL PROTECTED]>
Sent by: "ADSM: Dist Stor Manager" <[EMAIL PROTECTED]>
07/07/2003 07:14
Please respond to "ADSM: Dist Stor Manager"


        To:     [EMAIL PROTECTED]
        cc:
        Subject:        MVS select statement



Hello all!

I have been trying to set up a select statement to look for all of the
error and warning messages within the past 24 hours.  Here is what I have
come up with:

select date_time, msgno, message
   from actlog
   where severity='E' or severity='W'
   and date_time>(current_timestamp-(1 day))

My problem is that it goes through the entire 14 days of the activity log
that I have and ignores the last statement.  Any suggestions?

Thanks in advance!!!


**************************************
             Joni Moyer
     Systems Programmer
   [EMAIL PROTECTED]
          (717)975-8338

Reply via email to