For one of two reasons (probably) - and I think you found a bug:

1.  The syntax in your "set" clause is wrong.  It should be "set
alternatepreference='C',AltContactID='1'"  *Notice the use of a comma
instead of "and"*

2.  The row that matched the conditions in the "where" clause may already be
set to those values.  MySQL will not update a row needlessly.

I tried out your syntax on MySQL 3.23.47 (i.e. using "and" in the "set"
clause) and got some unexpected results.  Below is a synopsis of what
happened when I ran a query with the "and" syntax on my machine.

THE FIRST TIME
update events_terms set events_ID=512 and term='changed' where ID=108;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

It says a row was changed and it was -- but not correctly!  The events_ID
column was set to 0 and the term column was not changed at all.  That
doesn't seem like the correct behavior.  Then executed the query again...

THE SECOND TIME
update events_terms set events_ID=512 and term='changed' where ID=108;
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1  Changed: 0  Warnings: 0

No rows changed that time -- as should be the case.  Changing the syntax to
"update events_terms set events_ID=512,term='changed' where ID=108;" yielded
the desired results -- events_ID was set to 512 and term was set to changed.


Duncan
--
Duncan Salada | Titan | www.titan.com/testeval
Email: [EMAIL PROTECTED] | Voice: 301-925-3222x375 | Fax: 301-925-3216

> -----Original Message-----
> From: Richard Morton [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 23, 2002 10:44 AM
> To: MySQL List
> Subject: Update
> 
> 
> mysql> update contact set alternatepreference='C' and 
> AltContactID='1' where
> con
> tactid=2;
> Query OK, 0 rows affected (0.00 sec)
> Rows matched: 1  Changed: 0  Warnings: 0
> 
> 
> any ideas why the UPDATE did not perform an update?
> 
> Thanks
> 
> Rich
> 
> 
> ---------------------------------------------------------------------
> 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