postgresql - Why is this SQL updating the entire table -


i've been hit classic beginner mistake. if i'd done update no clause.

here's sql:

"update teams set description = ? " + "from teams t " + "join team_memberships tm on t.id = tm.team_id " + "join users u on tm.user_id = u.id " +  "where t.id = ? , u.uid = ?"; 

and despite t.id = ? sql still updates entire table.

... can see problem?

try one,

update teams t set description = ?   team_memberships tm        join users u on tm.user_id = u.id  t.id = tm.team_id ,       t.id = ? , u.uid = ? 

please backup db first before executing statement above


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -