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