I don't believe you need the second set

update Pictures set Date Posted = '2001-05-09', Notes = 'Test' where
ID ='1';

I think that should work 

-----Original Message-----
From: Barry L. Jeung [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 11, 2001 3:56 PM
To: [EMAIL PROTECTED]
Subject: Update problem, or more likely and problem understanding how to
do updates.


Ok, based on the given syntax from the mysql manual..

UPDATE [LOW_PRIORITY] [IGNORE] tbl_name
    SET col_name1=expr1, [col_name2=expr2, ...]
    [WHERE where_definition]
    [ORDER BY ...]
    [LIMIT #]

I've been trying to update some records in a test database I've been
playing with. I'm inexperienced with MySQL, so I'm hoping someone out
there can enlighten me. When trying to update more than one field at a
time, I get the following error:

ERROR 1064: You have an error in your SQL syntax near 'set Notes =
'Test' where ID ='1'' at line 1

I was trying to perform the following query to change the data below.

mysql> select * from Pictures;
+----+----------------+-------+--------------+-----------+-------------+
--------+-------+------------+
| ID | Category       | Title | Filename     | Submitter | Date_Posted |
Poster | Notes | Updated    |
+----+----------------+-------+--------------+-----------+-------------+
--------+-------+------------+
|  1 | Animal Funnies | pic1  | 00000001.jpg | Kiwi      | 2001-05-08  |
WRC    | aaa  | 0105111248 |
|  2 | Animal Funnies | asdfa | 00000002.jpg | dsoTm     | 2001-05-10  |
BLJ    |       | 0105111036 |
|  3 | Animal Funnies | test  | 00000003.jpg |           | 2001-05-10  |
BLJ    |       | 0105102219 |
+----+----------------+-------+--------------+-----------+-------------+
--------+-------+------------+

update Pictures set Date_Posted = '2001-05-09', set Notes = 'Test' where
ID ='1';

It looks syntatically correct according to the example in the manual,
but no matter which combination of fields I try and update, I get that
error. Single field updates for all fields works fine. The table is
defined as follows:
ID = mediumint(8) unsigned NOT NULL auto_increment
Category and Poster = enumerated.
Title, Filename, Submitter = varchar
Date_Posted = date
Notes = tinytext
Updated = timestamp

Please reply directly as I am not on the list. Thanks for your time.


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