User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 426,589 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,701 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser: Programming Forums
Views: 523 | Replies: 1
Reply
Join Date: Apr 2008
Posts: 196
Reputation: veledrom is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
veledrom veledrom is offline Offline
Junior Poster

how to compare rows

  #1  
Jun 29th, 2008
Hi,
I have 2 tables "name1_" and "name_2". I want to compare them.
If name in "name_1" table is same as name in "name_2" table, then copy whole row into other table "name_3".

Thanks
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2008
Posts: 58
Reputation: varmadba is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 7
varmadba varmadba is offline Offline
Junior Poster in Training

Re: how to compare rows

  #2  
Jun 30th, 2008
Try this...

if name_3 table is not yet created

 create table name_3
as
select name_1.* from name_1
inner join name_2
  on name_1.name=name_2.name 

if name_3 table is already created

 insert into name_3
select name_1.* from name_1
inner join name_2
  on name_1.name=name_2.name 
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb MySQL Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the MySQL Forum

All times are GMT -4. The time now is 10:40 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC