Mark,

Yes.

The Syntax is

  INSERT INTO table1
    SELECT * FROM table2

This assumes that the two tables have the same number of fields and
compatible types.
If not you need to specify either a field list in the insert, ie:

  INSERT INTO table1 ( field1, field2, ... )
    SELECT * FROM table2

or a field list in the select statement, ie:

  INSERT INTO table1
    SELECT field1, field2, ... FROM table2

or even both, ie:

  INSERT INTO table1 ( field11, field12 )
    SELECT field21, field22 FROM table2

Clear?

TTFN.
----
Struan Judd     <*>             EMail:          [EMAIL PROTECTED]
CJN Technologies Ltd            Phone:          +64 (9) 415 4796
All opinions mine only  Mobile: +64 (21) 685 335


> -----Original Message-----
> From: Mark Derricutt [mailto:[EMAIL PROTECTED]]
> Sent: Monday, 15 March 1999 10:15
> To: Multiple recipients of list delphi
> Subject: [DUG]: SQL Query...
> 
> 
> Is it possible to do an "insert into" query and supply a series of
> values from a "select from" query?
> 
> I want to do something like:
> 
>   insert into sometable values {
>     select * from someothertable where id = 2 }
> 
> ???
> --------------------------------------------------------------
> -------------
>     New Zealand Delphi Users group - Delphi List - 
> [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> 
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to