$sql = mysql_query(SELECT DISTINCT dep FROM job);
while($F1=mysql_fetch_array($sql))
{
$sql2 = mysql_query(SELECT * FROM job where dep = '$F1[dep]');
echo $F1[dep];
echo mysql_num_rows($sql2);
}
</tr>
<?
$num_job = 0;
$sql_job= "select d.dep_name,count(j.job_id) as job_count from dep d inner join job j on d.dep_id = j.dep where year(j.date)=$selYear and month(j.date)=$selMonth group by d.dep_id"
$query= mysql_db_query($dbname,$sql_job);
while($result=mysql_fetch_array($query))
{
$num_job++;
echo "<tr><td><img src='img/sub.png'>$result[dep_name]</td><td><center>$result[job_count]</center></td></td></tr>";
}
echo "<tr><td><center><strong>รวมการแจ้งซ่อมทั้งหมด $num_job ครั้ง</strong></center></td></td></tr>";
echo '</table>' ;
?>
</tr>
<?
$num_job = 0;
$sql_job= "select d.dep_name,count(j.job_id) as job_count from dep d inner join job j on d.dep_id = j.dep where year(j.date)=$selYear and month(j.date)=$selMonth group by d.dep_id"
$query= mysql_db_query($dbname,$sql_job);
while($result=mysql_fetch_array($query))
{
$num_job++;
echo "<tr><td><img src='img/sub.png'>$result[dep_name]</td><td><center>$result[job_count]</center></td></td></tr>";
}
echo "<tr><td><center><strong>รวมการแจ้งซ่อมทั้งหมด $num_job ครั้ง</strong></center></td></td></tr>";
echo '</table>' ;
?>