Forum Moderators: open

Message Too Old, No Replies

Compare two tables

         

Seraph

4:53 am on Feb 3, 2007 (gmt 0)

10+ Year Member



I think this the correct forum to post this question in :)

Anyway I am trying to compare two tables of data against one another and display the differences to the user, which I was somewhat successful using a LEFT JOIN query.

However I need it to be user specific so that it only compares the data from the table that is from one specific user (as multiple users use the same database to store their information). I have looked through some other close example but have found nothing that works, a sample of the code is here:


"SELECT DISTINCT table1.*
FROM `table1` table1
LEFT JOIN `table2` table2 ON table1.PIC = table2.PIC
WHERE table2.PIC IS NULL";

Any help would be greatly appreciated :)

FalseDawn

5:25 pm on Feb 4, 2007 (gmt 0)

10+ Year Member




compare two tables of data against one another and display the differences to the user

Your requirement is not specific enough - what differences exactly are you trying to discover? There could be records in table 1 that are not in table 2 (and vice-versa) (or both), table1 and table2 could match on the joined field, but (numerous) other fields could contain different values.