I need to update this table in SQL Server with data from its \'parent\' table, see below:
Table: sale
id (int)
udid
PostgreSQL:
CREATE TABLE ud (id integer, assid integer);
CREATE TABLE sales (id integer, udid integer, assid integer);
UPDATE ud
SET assid = sales.assid
FROM sales
WHERE sales.id = ud.id;
And in MS ACCESS:
UPDATE ud
INNER JOIN sale ON ud.id = sale.udid
SET ud.assid = sale.assid;
The following statement with FROM keyword is used to update multiple rows with a join
UPDATE users
set users.DivisionId=divisions.DivisionId
from divisions join users on divisions.Name=users.Division
I was thinking the SQL-Server one in the top post would work for Sybase since they are both T-SQL but unfortunately not.
For Sybase I found the update needs to be on the table itself not the alias:
update ud
set u.assid = s.assid
from ud u
inner join sale s on
u.id = s.udid