Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
01-11-2010, 08:11 PM #1
- Join Date
- May 2006
- Thanked 4 Times in 4 Posts
How do I compare these 2 tables ?
I have two comparisons that I need to do and they are a bit
beyond my knowledge, would appreciate some help.
I have two tables that have an identical structure,
one is the incoming daily update, tableA which I want to
compare to the history tableB.
Both structures look like this:
id, title, desc, data1, data2, ... data18
The first comparison is to check for new rows. I think I can
do this by using the LEFT JOIN command
Is this how I do it ?
$query = "SELECT tableA.*, tableB.* FROM tableA LEFT JOIN tableB ON tableA.id = tableB.id"; $result = mysql_query($query) or die(mysql_error());
My second comparison is to compare all the rows that have same ids
but have differences in the other fields i.e. not NEW records but CHANGED records.