UPDATE myTable
SET DueField = 0,
    StatusField = IF(StatusField = 'O', 'C', StatusField)
WHERE PrimaryKeyField = "XYZXYZ";

-- Greg Johnson

-----Original Message-----
From: Chris Boget [mailto:[EMAIL PROTECTED]]
Sent: Friday, December 07, 2001 1:42 PM
To: [EMAIL PROTECTED]
Subject: Can this be done?


Is there a way to do this?  If so, I've not been able to
find it in the documentation...

I have 3 fields:

PrimaryKeyField
StatusField
DueField

I want to update the DueField to 0 (zero) where the
PrimaryKeyField = "XYZXYZ".  I also want to update
the StatusField for those records to be equal to "C" 
when it's equal to "O" but not any other value.  Is there
a way to do this all in one query?

<pseudocode>

UPDATE myTable SET
DueField = 0,
( StatusField = "C" WHEN StatusField = "O")
WHERE PrimaryKeyField = "XYZXYZ";

</pseudocode>

Can something like that be done?

Chris



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to