<?
$nrow=0;
$sql7 = mysql_query("select A,B,SUM(C) AS E FROM (select s1.status_id A,s1.status_name B,COUNT(a2.asset_service_id) AS C from asset_service a2
left join asset_status s1 on s1.status_id=a2.asset_service_status
where asset_service_user=5
GROUP BY a2.asset_service_status
UNION
select s.status_id A,s.status_name B,COUNT(a1.asset_service_id) AS C from asset_service a1
left join asset_repair a2 on a2.asset_service_id=a1.asset_service_id
left join asset_status s on s.status_id=a1.asset_service_status
where a2.user_repair=5) D
GROUP BY A
ORDER BY E DESC
");
$records7 = mysql_num_rows($sql7);
?>
<table style="border: none;font-size: 12px;color: #5b5b5b;width: 90%;margin: 10px 0 10px 0;">
<tr>
<td><div align="center"><b>อันดับ</b></div></td>
<td><div align="left"><b>สถานะการซ่อม</b></div></td>
<td><div align="center"><b>จำนวน (ครั้ง)</b></div></td>
</tr>
<?
while($objResult7 = mysql_fetch_array($sql7))
{ $i++;
?>
<tbody>
<tr>
<td><div align="center"><? echo ++$nrow; ?></div></td>
<td><?=$objResult7["B"];?></td>
<td><div align="center"><b>
<a href="asset_user_reports_repair_status.php?asset_service_user=<?='5';?>&asset_service_status=<?='1';?>">
<?=$objResult7["E"];?>//สิ้งค์ส่งค่า
</a>
</b>
</div></td>
</tr>
<? }?>