Skip site navigation (1) Skip section navigation (2)

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 (view raw or flat)
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

pgsql-sql by date

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

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group