Jump to content

Recommended Posts

Hello everybody i am trying this to insert records from 2tables where field of table 1=field of table 2 because i wanto eliminate non matching data in both tables that's i am creating a third table, need help please

 

INSERT INTO newtable(Field)
SELECT Field,Field
FROM Table1.Field,Table2.Field
WHERE Table1.Field=Table2.Field

Link to comment
https://forums.phpfreaks.com/topic/226213-insert-data-from-2tables/
Share on other sites

Hi,

 

 

Whats your question?

insert...select

 

 

 

INSERT INTO tbl_temp2 (fld_id)  SELECT tbl_temp1.fld_order_id  FROM tbl_temp1 WHERE tbl_temp1.fld_order_id > 100;[/color]



Why do you select your "Field" column twice?

 

THANKS for you reply

I was intending to take unique records from a table, instead of deleting now i used this code

 

Create table tmp_tbl as select Distinct fld from tbl; 

 

This solved the problem, because i took unique records and inserted them into another table, and then from the tmp_tbl i can use the unique data.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.