Jump to content

Insert into table from two tables , need a join??


scotchegg78

Recommended Posts

Hi I have ran a query thats taking forever!

 

Do i need a join for this,

 

Its INSERT INTO new_table (field1,field2,...fieldn) SELECT table_1.id,table_1.name,table_2.company FROM table_1,table_2;

 

So simple I have a tabel I am inserting fields from two tables into.

 

thanks

 

Here is the new full code...

 

does this look ok?

Could it be better?

 

Insert Into listing_content(listingID,listingName,registeredOwner,registeredManager,RoomNum,registeredCareCategory) SELECT listing.listingID,address.tempHomeName,address.temp_owner,address.temp_regmanager,address.temp_beds,address.temp_regcarecategory FROM listing LEFT JOIN address ON listing.addressID = address.addressID;

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.