The syntax you gave is almost correct. You have to make sure that the
query is going to return a matching number of fields (with matching types
for the table). It's a good idea to explicitly name the fields.
e.g.
INSERT INTO MY_TABLE (MY_FIELD1, MY_FIELD2)
SELECT MY_FIELD3, MY_FIELD4
FROM MY_OTHER_TABLE
WHERE MY_FIELD3 = 'x';
You can do this with any query that returns a result set that will be
suitable for the table being loaded. Note: I know this works under Oracle
and Interbase - can't speak for others.
Cheers.
BJ...
----------
From: Mark Derricutt[SMTP:[EMAIL PROTECTED]]
Reply To: [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