I want to query only the entries in table2 which contains a "course" value and "course" does not exist in table1. I initially inner joined table1 to table2 based on the "course" value. Here's what I have so far, which doesn't work:
$query = "SELECT value1,value2,value3 FROM table2 INNER JOIN table1 USING(course)
WHERE table2.sem = '$semester' AND NOT EXISTS (SELECT course FROM table1)
ORDER BY course";
$result = mysql_query($query2) or die(mysql_error());
while ($row2 = mysql_fetch_array($result))
{
print_r($row);echo "<br><br>";
}
This inner join code works:
$query = "SELECT * FROM table1 INNER JOIN table2 USING(course)
WHERE table1.sem = '$semester'
ORDER BY course";
$result = mysql_query($query) or die(mysql_error());