Click here to Skip to main content
14,935,891 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi frnds,

im trying to find out unmatched records from 2 tables i had tried below query it works fine but i need to find for multiple column matching plz help

res = mysql_query("SELECT * FROM emp WHERE emp.roll_no NOT IN (SELECT emp_no FROM emp_old)");

similarly i had did as follows..
it has error..

emp has rollno and name

emp_old has emp_no and name

i need to find out for this two columns which are unmatched

res = mysql_query("SELECT * FROM emp WHERE emp.roll_no AND NOT IN (SELECT emp_no AND name FROM emp_old)");

1 solution

Hello, try these ones
  FROM emp
 WHERE NOT EXISTS (SELECT emp_old.roll_no,
                     FROM emp_old
                    WHERE emp_old.roll_no = emp.roll_no AND

SELECT emp.*
  FROM emp
  LEFT JOIN emp_old
    ON emp_old.roll_no = emp.roll_no AND =
Arun-23 23-Jan-14 2:20am
its working its listing out unmatched list of 2 columns emp_no & name i want to highlight this two columns according to result is this possible..
skydger 23-Jan-14 14:00pm
Where do you wish to highlight these columns?
Arun-23 23-Jan-14 23:44pm
in fetched result
echo "<tr>";
echo "<td align='center' width='200'>" . $row['roll_no'] . "</td>";// which rollno is wrong in red color
echo "<td align='left' width='200'>" . $row['name'] . "</td>";//which name is wrong in blue color
echo "</tr>";

echo "</table>";
skydger 24-Jan-14 2:01am
Consider to use for html 4.0 or to use CSS. Please refer following link for details:

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900