Thanks, Jeremy

What I actually needed was:

UPDATE Table 
SET CounterValue = CounterValue+1, 
CounterStartDateTime = 
IF(CounterStartDateTime IS NULL, Now(), CounterStartDateTime)

This prevents it going back to NULL if the value is already not NULL.

Thanks again.

Terry

----------Original Message---------  

> > UPDATE Table SET CounterValue = CounterValue+1, CounterStartDateTime 
> > = (IF CounterStartDateTime IS NULL, Now())
> > 
> > without success.
> 
> It looks like you just have the syntax wrong.  Try:
> 
> UPDATE Table SET CounterValue = CounterValue+1, CounterStartDateTime = 
> IF(CounterStartDateTime IS NULL, Now(), NULL);
> 
> See:
> http://www.mysql.com/doc/en/Control_flow_functions.html
> 


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to