PDA

View Full Version : SQL to update table value from key from another table



scolabear
12-13-2010, 03:32 AM
hi people,

Does anyone know how I can update HEMPLAYERNOTES.icon_id from a set of player_id's that I hold in a view.

I have:



UPDATE hemplayernotes
SET icon_id=2
WHERE player_id in (SELECT f.player_id
FROM myView f) returning player_id;

at present but despite myView containgin 29 player_ids only a single row of HEMPLAYERNOTES is affected.

Any help greatly profitable, i mean appreciated ;p

scolabear
12-13-2010, 06:11 AM
INSERT INTO hemplayernotes (player_id) select player_id from filterGiveUp;

my bad, problem solved.