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: (view raw, whole thread or download thread mbox)
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


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-2017 The PostgreSQL Global Development Group