Add column by using SELECT statement

From: John Zhang <johnzhang06(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Add column by using SELECT statement
Date: 2009-02-25 03:37:54
Message-ID: 618950b80902241937y3e48e3c7ua3614c87d373ec71@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Hi all,

I was wondering how I can add a column and populate it by some query.

For example:
TblA (Id, fld1)
TblB(Id, fld1, fld2)

I have a query:
SELECT b.fld2
FROM tblB b
WHERE condition1

what I want to do is add a column in tblA: fld2
and polpulate the newly added field with the query
on tblA.Id=tblB.Id

Any advice? Any input would be much appreciated.

Thanks a lot
John

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message A. Kretschmer 2009-02-25 06:33:59 Re: Add column by using SELECT statement
Previous Message Fernando Hevia 2009-02-24 19:59:01 Re: Best practices for geo-spatial city name searches?