Update with join erroring

I am trying to update on table with a sequence_number value from another table.

It errors out. Please can anyone explain what I am overlooking?

bazz

query:


update page_blocks_stock
set default_sequence = page_blocks_set.sequence_number
FROM page_blocks_stock 
INNER 
JOIN 
page_blocks_set 
on page_blocks_set.page_block_name = page_blocks_stock.page_block_name
WHERE page_blocks_set.business_id = 477
and page_blocks_set.live_dev = 'live'
and page_blocks_set.script_name = 'default'




error msg

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘FROM page_blocks_stock as pbs
INNER
JOIN
page_blocks_set as pbset
on pbset’ at line 3

As far as I know, you can’t use JOIN in an update statement: MySQL :: MySQL 5.1 Reference Manual :: 12.2.10 UPDATE Syntax

sure you can :slight_smile:

:cool:

bazz, you can’t say SET FROM :slight_smile:

Oops… :blush:

Thanks to you both.