Re: Ok, what am I doing wrong here?

From: Tomasz Myrta <jasiek(at)klaster(dot)net>
To: Karl Denninger <karl(at)denninger(dot)net>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Ok, what am I doing wrong here?
Date: 2004-02-17 16:34:46
Message-ID: 403242A6.4040302@klaster.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Dnia 2004-02-17 17:02, Użytkownik Karl Denninger napisał:
> I want to insert values from one table into another, and add some "default"
> values (that are not defaults on the table different reasons - that is, this
> is maintenance function and in normal operation there would be "real" values
> there - and null is valid)
>
> So, I want to do, for example, the following:
>
> insert into table (id, time, type) values (select id, now(), '1' from secondtable);

Documentation says:
INSERT INTO table [ ( column [, ...] ) ]
{ DEFAULT VALUES | VALUES ( { expression | DEFAULT } [, ...] ) |
SELECT query }

insert into table (id, time, type)
select id, now(), '1' from secondtable;

Regards,
Tomasz Myrta

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Karl Denninger 2004-02-17 16:58:00 Re: Ok, what am I doing wrong here?
Previous Message Stephan Szabo 2004-02-17 16:29:06 Re: Ok, what am I doing wrong here?