Ok,

I have Servers Alive logging to a MySQL database. 

The time fields it uses are varchar data types but the contents look like:
'3/4/2003 9:45:16 PM'

I am trying to select from the table based upon the datetime field (actually
I only care about the date part of the datetime.

The problem is I cannot find a function that allows me to perform
comparisons against the datetime value in the varchar field. (basically
an aggregate function within a where clause)

The table structure:
----------------------------------------------------------------------
CREATE TABLE salive (
  SAID varchar(15) default NULL,
  host varchar(50) default NULL,
  UID decimal(10,0) default NULL,
  status int(11) default NULL,
  previousstatus int(11) default NULL,
  laststatuschange varchar(26) default NULL,
  previousstatuschange varchar(26) default NULL,
  timing decimal(10,0) default NULL
) TYPE=MyISAM;

----------------------------------------------------------------------
The pertinent fields are the [x]statuschange fields.

My query (which doesn't work but illustrates my thought process...):
----------------------------------------------------------------------
SELECT
    host,
    status,
    previousstatus,
    laststatuschange,
    previousstatuschange,
    timing
FROM
    salive
WHERE
    DATE_FORMAT( laststatuschange,  "%m/%d/%Y"  )  > DATE_FORMAT(
'23/03/2003',  '%m/%d/%Y'  )
    AND  STATUS  = 5
ORDER  BY
    host,
    previousstatus,
    laststatuschange

----------------------------------------------------------------------

Anyone else pinging MySQL for logging?  Any ideas?
To unsubscribe from a list, send a mail message to [EMAIL PROTECTED]
With the following in the body of the message:
   unsubscribe SAlive

Reply via email to