I wanna compare 2 tables to get data that doesn’t same.
tb1 tb2
============== ==============
|id| doc_name| |id| doc_summ|
============== ==============
|1 | 01180543| |1 | 01180543|
|2 | Chord | ==============
==============
I wanna compare doc_name and doc_summ. from that example the result must be Chord.
$q = mysql_query(" SELECT t1.doc_name FROM tb1 as t1, tb2 as t2 WHERE t1.doc_name != t2.doc_summ");
while ($row = mysql_fetch_array($q)){
$doc_copy = $row['doc_name'];
}
but the result still returns all of data. what’s wrong? thank you 🙂
You can join both tables using
LEFT JOIN. What it does is it only display the records of table 1 if it has no match on table 2.