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

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -