I'm not aware of a MySql join that will accomplish this. Maybe someone else will. I certainly hope so, because the only other solution I can think of is to change the field name of "Date" in table 2 and do the join with a simple conditional statement when you fetch the results. Say the "Date" field in table2 was changed to "Dateb". Then, the query is very simple. Let's assume you want to drop the results into a table for display.
echo "<table>";
select * from table1, table2
where table1.staff_id = table2.staff_id
The trick is to account for all five fields in the process of stepping through the results array.
For instance if the query were $q, and the run statement were $r, then you would step through the array:
While($w = mysql_fetch_array($r, MYSQL_ASSOC))
{
$s = $w["staff_id"];
$d = $w["Date"];
$db = $w["Dateb"];
$m = $w["remark"];
$o = $w["other_field"];
if($d == $db)
{
echo "<tr><td>".$s."</td><td>".$d."</td><td>".$m."</td><td>".$o."</td></tr>";
}
else
{
echo "<tr><td>".$s."</td><td>".$d."</td><td></td><td>".$o."</td></tr>";
echo "<tr><td>".$s."</td><td>".$db."</td><td>".$m."</td><td></td></tr>";
}}
echo"</table>";
The table layout is crude, but should be effective. Basically all you are doing is taking each row and saying "if the date from table1 is the same as the date from table2, then echo them both as one result. If not, echo the date from table1 with the other field while leaving the remark field blank, then, on a separate line echo the date from table2 with the remark while leaving the other field blank". I tested this and it does return the results you desire. The only thing is that you would have to change the name of the "Date" field on one of the tables. Otherwise MySql will replace the initial table1 Date value with the table2 Date value.