Re: Help with a complex Update - Mailing list pgsql-sql

From Ross J. Reedstrom
Subject Re: Help with a complex Update
Date
Msg-id 20011105092632.A4292@rice.edu
Whole thread Raw
In response to Help with a complex Update  (Orion <o2@trustcommerce.com>)
List pgsql-sql
On Fri, Nov 02, 2001 at 03:15:36PM -0800, Orion wrote:
> I have a table of users and a table of user_actions.
> I'd like to have a first_action column in the user table. 
> 
> How would I go about updating that info.
> 
> I'd immagine it'd be something like this:
> 
> update user_info set first_action = (select min(action_timestamp) from 
> action_info where user_id = ?? current user id ??);

Guessing at your table schema, but I think you want:
update user_info set first_action =  min(action_timestamp) from action_info where action_info.user_id = user_id;

Ross


pgsql-sql by date:

Previous
From: Haller Christoph
Date:
Subject: table permissions II
Next
From: Janning Vygen
Date:
Subject: design tool