SELECT distinct source_IP, timestamp FROM tb1 , tb2 WHERE tb1.source_IP
not in ( SELECT source_IP FROM tb2 WHERE tb1.source_IP = tb2.source_IP)
AND tb1.timestamp not in
( SELECT timestamp FROM tb2 WHERE tb1.timestamp = tb2.timestamp )
The above query has been written to compare attributes (source_IP and timestamp) of tb1 with the same attributes in tb2 and select only the distinct ones that belong to tb1. However, this query is working fine, but I am looking for better way to make it more efficient, since there are three queries in the statement. Any suggestions please.
Thanks God, this query is working fine:
Thanks to Roee Adler
compare differences between two tables in mysql