What about REPLACE?

http://www.mysql.com/doc/R/E/REPLACE.html

'REPLACE works exactly like INSERT, except that if an old record in the
table has the same value as a new record on a unique index, the old record
is deleted before the new record is inserted'

Regards,
Dan

> -----Original Message-----
> From: Rick Emery [mailto:[EMAIL PROTECTED]]
> Sent: Friday, 15 February 2002 11:10 a.m.
> To: [EMAIL PROTECTED]
> Cc: '[EMAIL PROTECTED]'
> Subject: FW: [PHP] MySQL question...not sure if this is the correct
> forum to ask.
>
>
> -----Original Message-----
> From: Peter Ruan [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, February 14, 2002 4:04 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] MySQL question...not sure if this is the correct forum to
> ask.
>
>
> Hi,
>
> Can the UPDATE statement have conditional check embedded in it?  I
> have a page that displays a record (in a FORM format) that the user can
> change the information on each column.  I want to check each column and
> see which has been changed and update the table for entries that were
> changed only.
>
> for each column data {
>   if column is changed
>       then update;
>   else
>       do nothing;
> }
>
> Maybe I am making this too complicated than it needs and just go ahead
> and update all of the columns regardless with the new values, regardless
> they are actually different or not.
>
> Thanks in advance,
> -Peter
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.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
>
>


---------------------------------------------------------------------
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