468,532 Members | 1,632 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,532 developers. It's quick & easy.

How to compare two fields, from 2 tables in 2 different databases ?

Hey im trying to do the following in PHP:

Connect to 2 different databases, one named complete and one
incomplete.

My goal is to find whats missing in the "incomplete" database.

The fields i want to compare in the database/table is named 'name' in
both. This field is comtaining unique names

How would you guys do that? arr1 vs arr2 compare or maybe some left
join sql?
I want to output the diff to screen.

Anyone can show me a sample, to get me in the right direction?

Thanks in advance
Jan
Jun 2 '08 #1
3 3113
alter.fire wrote:
Hey im trying to do the following in PHP:

Connect to 2 different databases, one named complete and one
incomplete.

My goal is to find whats missing in the "incomplete" database.

The fields i want to compare in the database/table is named 'name' in
both. This field is comtaining unique names

How would you guys do that? arr1 vs arr2 compare or maybe some left
join sql?
I want to output the diff to screen.

Anyone can show me a sample, to get me in the right direction?

Thanks in advance
Jan
Not too hard to do in php... Make 2 arrays with the names and array_diff
them.
Jun 2 '08 #2
On May 12, 6:26 am, Mike Lahey <mikey6...@yahoo.comwrote:
alter.fire wrote:
Hey im trying to do the following in PHP:
Connect to 2 different databases, one named complete and one
incomplete.
My goal is to find whats missing in the "incomplete" database.
The fields i want to compare in the database/table is named 'name' in
both. This field is comtaining unique names
How would you guys do that? arr1 vs arr2 compare or maybe some left
join sql?
I want to output the diff to screen.
Anyone can show me a sample, to get me in the right direction?
Thanks in advance
Jan

Not too hard to do in php... Make 2 arrays with the names and array_diff
them.
I don't think it displays a nice difference ?
Jun 2 '08 #3
alter.fire wrote:
Hey im trying to do the following in PHP:

Connect to 2 different databases, one named complete and one
incomplete.

My goal is to find whats missing in the "incomplete" database.

The fields i want to compare in the database/table is named 'name' in
both. This field is comtaining unique names

How would you guys do that? arr1 vs arr2 compare or maybe some left
join sql?
I want to output the diff to screen.

Anyone can show me a sample, to get me in the right direction?

Thanks in advance
Jan
I'm assuming you're using MySQL - just because most people here are. If
so, you don't even need PHP. Try comp.databases.mysql for a SQL only
solution.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Jun 2 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Evgeny Gopengauz | last post: by
1 post views Thread by Prakash RudraRaju | last post: by
8 posts views Thread by Vincent | last post: by
1 post views Thread by Stephen | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.