What is wrong with this query?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Xephon
Forum Newbie
Posts: 20
Joined: Sat May 15, 2004 10:58 pm

What is wrong with this query?

Post by Xephon »

UPDATE nuke_users,
ipb_member_extra SET nuke_users.pn_user_viewemail = 1,
ipb_member_extra.email_full = 0,
ipb_member_extra.email_pm = 0,
ipb_member_extra.allow_admin_mails = 0,
ipb_member_extra.auto_track = 0 where nuke_users.pn_uid = 2 AND ipb_member_extra.id = 2


MySQL said:


You have an error in your SQL syntax near ' ipb_member_extra SET nuke_users.pn_user_viewemail=1, ipb_member_extra.email_ful' at line 1


what is wrong, since the error it gives does not give me any hints :/
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

it's trying to tell you that you can't update the 2 tables at the same time, I think..
Xephon
Forum Newbie
Posts: 20
Joined: Sat May 15, 2004 10:58 pm

Post by Xephon »

really?

that is odd, since the mysql manual lists many examples of updating 2 tables at once

or atleast i thought it did :/
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

UPDATE Syntax wrote:Starting with MySQL 4.0.4, you can also perform UPDATE operations that cover multiple tables:

Code: Select all

UPDATE items,month SET items.price=month.price
WHERE items.id=month.id;
Xephon
Forum Newbie
Posts: 20
Joined: Sat May 15, 2004 10:58 pm

Post by Xephon »

yah u were right, i split it up into 2 parts and BAM it worked lol

i saw that, but for some reason it still did not work using 2 tables (maybe the mysql version on the server my site is on is below ver 4.0.4)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you can run a VERSION() query, or run phpinfo() to find out definitively

Code: Select all

SELECT VERSION()

Code: Select all

<?php phpinfo(); ?>
Xephon
Forum Newbie
Posts: 20
Joined: Sat May 15, 2004 10:58 pm

Post by Xephon »

Client API version 3.23.58
Post Reply