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

Winapi c++: DialogBox hangs when breaking a loop -

vb.net - Font adding using PDFsharp -

javascript - jQuery iScroll clickable list elements while retaining scroll? -