List:General Discussion« Previous MessageNext Message »
From:william drescher Date:February 11 2012 2:14pm
Subject:Re: conditional updating
View as plain text  
On 2/9/2012 8:58 AM, Reindl Harald wrote:
>
>
> Am 09.02.2012 14:55, schrieb william drescher:
>> On 2/9/2012 8:22 AM, Johnny Withers wrote:
>>> Update table set mydate=now() where mydate='0000-00-00'; should do it.
>>   can't do that because the record is selected by other criteria.
>
> so explain the criteria, show us the query
>
> usually you do exatcly the same WHERE as for the select and add
> and mydate='0000-00-00'
>

The query was to find a record by a unique ID, then update last 
access to now, and then update first access date to curdate() if 
it is 0000-00-00.

So, I obviously can not select the record based on first access 
as I need to update it regardless of the value of first access.

IF() works like a charm.

bill

Thread
conditional updatingwilliam drescher9 Feb
  • Re: conditional updatingMichael Dykman9 Feb
    • Re: conditional updatingwilliam drescher9 Feb
  • Re: conditional updatingJohnny Withers9 Feb
    • Re: conditional updatingwilliam drescher9 Feb
      • Re: conditional updatingReindl Harald9 Feb
        • Re: conditional updatingwilliam drescher11 Feb
      • Re: conditional updatingJohnny Withers9 Feb
        • Re: conditional updatingMichael Dykman9 Feb
          • Re: conditional updatingJohnny Withers9 Feb