Re: polating (insert into...) a table with determined record from another table.

From: Prabu Subroto <prabu_subroto(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: polating (insert into...) a table with determined record from another table.
Date: 2004-07-23 12:15:33
Message-ID: 20040723121533.1688.qmail@web41802.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

It's solved....

Thank you very...very...much my friend Harald.
--- Harald Fuchs <hf0722x(at)protecting(dot)net> wrote:
> In article
>
<20040722131503(dot)82949(dot)qmail(at)web41803(dot)mail(dot)yahoo(dot)com>,
> Prabu Subroto <prabu_subroto(at)yahoo(dot)com> writes:
>
> > Dear my friends...
> > I created a table (named : sven1). I want to
> populate
> > this table with the record from another table
> (named :
> > appoinment).
> > but I don't know how to formulate the sql query.
>
> > I tried this one:
> > insert into sven1 (custid, noapp) values ((select
> > custid from appointment where done='N' and
> > salesid='6'), (select noapp from appointment where
> > done='N' and salesid='6'));
>
> It's far easier:
>
> INSERT INTO sven1 (custid, noapp)
> SELECT custid, noapp
> FROM appointment
> WHERE done = 'N'
> AND salesid = '6'
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 9: the planner will ignore your desire to choose
> an index scan if your
> joining column's datatypes do not match
>



__________________________________
Do you Yahoo!?
Vote for the stars of Yahoo!'s next ad campaign!
http://advision.webevents.yahoo.com/yahoo/votelifeengine/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Christopher Browne 2004-07-23 12:44:59 Re: 2 postgresql processes on the same machine ?
Previous Message CSN 2004-07-23 09:48:01 select, columns, and aliases