Re: Help with a complex Update
| От | Josh Berkus |
|---|---|
| Тема | Re: Help with a complex Update |
| Дата | |
| Msg-id | web-498968@davinci.ethosmedia.com обсуждение исходный текст |
| Ответ на | Help with a complex Update (Orion <o2@trustcommerce.com>) |
| Список | pgsql-sql |
Orion, > update user_info set first_action = (select min(action_timestamp) > from > action_info where user_id = ?? current user id ??); Close. You need to use a subselect in the FROM clause: UPDATE user_info SET first_action = min_action FROM (select user_id, min(action_timestamp) as min_action FROM action_info WHERE user_id = $user_variable GROUPBY user_id) ma WHERE user_info.user_id = ma.user_id; -Josh ______AGLIO DATABASE SOLUTIONS___________________________ Josh Berkus Complete informationtechnology josh@agliodbs.com and data management solutions (415) 565-7293 for law firms, small businesses fax 621-2533 and non-profit organizations. San Francisco
В списке pgsql-sql по дате отправления: