What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » MySQL - Compare 2 tables

MySQL - Compare 2 tables
Author: Message:
CookieRevised
Elite Member
*****

Avatar

Posts: 15519
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: RE: MySQL - Compare 2 tables
quote:
Originally posted by Jimbo
... list all  the differences between integer fields if the difference is > 10...
Meaning you need to check if A is more than 10 bigger than B AND if A is more than 10 smaller than B, correct?. So...
quote:
Originally posted by matty
A.playerupgrade1 > ( B.playerupgrade1 + 10)
That will not list values in B which are at least 10 bigger than A; it will only list values in B which are at least 10 less than A!

Thus the correct clause would then be:
SQL code:
...
WHERE (
    ABS(A.playerupgrade1 - B.playerupgrade1) > 10
    OR ABS(A.playerupgrade2 - B.playerupgrade2) > 10
    OR ABS(A.playerupgrade3 - B.playerupgrade3) > 10
    OR ABS(A.playerupgrade4 - B.playerupgrade4) > 10
)

ABS() = take the absolute value of the number





------------


EDIT:
quote:
Originally posted by Jimbo
Well, the nature of my table, makes it impossible for the record to decrease from B to A
Ah... In that case I never said anything ;)

This post was edited on 10-08-2009 at 08:03 PM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
10-08-2009 07:21 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
MySQL - Compare 2 tables - by Jimbo on 10-08-2009 at 01:55 PM
RE: MySQL - by matty on 10-08-2009 at 01:58 PM
RE: MySQL - by Jimbo on 10-08-2009 at 01:59 PM
RE: MySQL - Compare 2 tables - by matty on 10-08-2009 at 02:18 PM
RE: MySQL - Compare 2 tables - by Jimbo on 10-08-2009 at 02:19 PM
RE: MySQL - Compare 2 tables - by matty on 10-08-2009 at 03:02 PM
RE: RE: MySQL - Compare 2 tables - by CookieRevised on 10-08-2009 at 07:21 PM
RE: MySQL - Compare 2 tables - by Jimbo on 10-08-2009 at 03:19 PM
RE: MySQL - Compare 2 tables - by Jimbo on 10-08-2009 at 07:57 PM
RE: MySQL - Compare 2 tables - by matty on 10-08-2009 at 08:09 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On