Friday, March 27, 2009

Return user defined fields after update

This will update and return the selected column's updated values. * will gives the entire updated row.

UPDATE 
               weather 
SET 
               temp_lo = temp_lo+1,
               temp_hi = temp_lo+15
WHERE 
               city = 'Delhi' AND

RETURNING 
               temp_lo, 
               temp_hi


Ref : http://www.postgresql.org/docs/current/static/sql-update.html


No comments:

Post a Comment