Unix Technical Forum

Show differences between two tables

This is a discussion on Show differences between two tables within the MySQL General forum forums, part of the MySQL category; --> Hi I've two tables TableA FieldID Enabled TableB FieldID Enabled What query would I need to show what FieldIDs ...


Go Back   Unix Technical Forum > Database Server Software > MySQL > MySQL General forum

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-27-2008, 09:16 PM
Neil Tompkins
 
Posts: n/a
Default Show differences between two tables

Hi
I've two tables

TableA
FieldID
Enabled

TableB
FieldID
Enabled

What query would I need to show what FieldIDs which are the same, but the enabled field status is different ?Thanks,
Neil
__________________________________________________ _______________
Be one of the first to try Windows Live Mail.
http://ideas.live.com/programpage.as...e-4911fb2b2e6d
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-27-2008, 09:17 PM
Jerry Stuckle
 
Posts: n/a
Default Re: Show differences between two tables

Neil Tompkins wrote:
> Hi
> I've two tables
>
> TableA
> FieldID
> Enabled
>
> TableB
> FieldID
> Enabled
>
> What query would I need to show what FieldIDs which are the same, but the enabled field status is different ?Thanks,
> Neil
> __________________________________________________ _______________
> Be one of the first to try Windows Live Mail.
> http://ideas.live.com/programpage.as...e-4911fb2b2e6d


How about

SELECT a. FieldID, a.Enabled, b.Enabled
FROM TableA b, TableB b
WHERE a.FieldID=B.FieldID and a.Enabled <> b.Enabled

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 02-27-2008, 09:17 PM
Dan Buettner
 
Posts: n/a
Default Re: Show differences between two tables

Hi Neil -

Something like this ought to work, joining on the ID column to find matches
between tables, then finding the enabled fields which are not equal.

SELECT a.fieldID, a.enabled, b.enabled
FROM TableA a, TableB b
WHERE a.fieldID = b.fieldID
AND a.enabled != b.enabled

Dan


On 9/15/06, Neil Tompkins <neildtompkins@hotmail.com> wrote:
>
> Hi
> I've two tables
>
> TableA
> FieldID
> Enabled
>
> TableB
> FieldID
> Enabled
>
> What query would I need to show what FieldIDs which are the same, but the
> enabled field status is different ?Thanks,
> Neil
> __________________________________________________ _______________
> Be one of the first to try Windows Live Mail.
>
> http://ideas.live.com/programpage.as...e-4911fb2b2e6d
>


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 02-27-2008, 09:17 PM
Jerry Schwartz
 
Posts: n/a
Default RE: Show differences between two tables

This may be the blind leading the one-eyed, but wouldn't

SELECT FieldID FROM TableA, TableB WHERE TableA.FieldID = TableB.FieldID AND
TableA.Enabled != TableB.Enabled;

Work?


Regards,

Jerry Schwartz
Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032

860.674.8796 / FAX: 860.674.8341

-----Original Message-----
From: Neil Tompkins [mailto:neildtompkins@hotmail.com]
Sent: Friday, September 15, 2006 5:04 AM
To: mysql@lists.mysql.com
Subject: Show differences between two tables

Hi
I've two tables

TableA
FieldID
Enabled

TableB
FieldID
Enabled

What query would I need to show what FieldIDs which are the same, but the
enabled field status is different ?Thanks,
Neil
__________________________________________________ _______________
Be one of the first to try Windows Live Mail.
http://ideas.live.com/programpage.as...-4314-9b0e-491
1fb2b2e6d



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:16 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com