Update latest column in master table from transaction table

From: Arvind Singh <arvindps(at)hotmail(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Update latest column in master table from transaction table
Date: 2012-11-03 07:03:21
Message-ID: BLU164-W48177FDA355AF82B9046C1CA660@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


hello,

i have two tables
customer_master
> cname
> lastreceiptdate
> lastreceiptamt
accounts
> cname
> date
> amount

i need help in constructing a single update query. where the customer_master table is updated with the latest receipt date and receipt amount for a single customer code (cname like "FRUITXXXXX") from accounts table

so far we are using a select command to retrieve a record with max(Date) and then using another update command to update using results from the select query.

thanks

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Yvon Thoraval 2012-11-03 08:11:51 PostgreSQL and IPV6
Previous Message Craig Ringer 2012-11-03 05:19:05 Re: role does not exist