List:General Discussion« Previous MessageNext Message »
From:Davor Cengija Date:April 20 1999 5:03pm
Subject:[newbie] how to 'embed' SELECT into INSERT
View as plain text  
       (newbie, 2 weeks with mysql, please forgive:-))

       how can i do something like this:

INSERT INTO table1 VALUES 
	("A", 1, (SELECT column FROM table2 WHERE something =
       "something"));

       yes, i know MySQL does not support embedded selections (yet)
       and i'm probably asking for some function to do the job for
       me.

       maybe i first need to create some temp. table, INSERT INTO
       temp_table SELECT column FROM table2 WHERE etc... and then put
       those data into table1 like 
INSERT INTO table1(third_column) SELECT * FROM temp_table;

       is there a better way?

       a good URL would be helpful, as well (but i allready checked
       the main mailing list archives).

       if you don't understand what am i asking, i'll elaborate it
       better including examples.

-- 
      v
Davor Cengija
Davor.Cengija@stripped
-----------------------------------
"Please allow 30 days for delivery"

Thread
[newbie] how to 'embed' SELECT into INSERTDavor Cengija20 Apr
  • Re: [newbie] how to 'embed' SELECT into INSERTPaul DuBois20 Apr
    • Re: [newbie] how to 'embed' SELECT into INSERTDavor Cengija21 Apr