$sql = "SELECT count(colum1) as total,(number) as numbers FROM table1 natural join table_detail where t_date BETWEEN '$date' AND '$date2' AND t_time = '$time' group by colum1 having total>1 order by total desc LIMIT 5";
$query = mysql_query($sql) or die(mysql_error());
$num = mysql_num_rows($query);
for($i=1;$i<=$num;$i++)
{
$row = mysql_fetch_array($query);
$intnum = $row['numbers'];
$countt = $row['total'];
}
$sql = "SELECT count(colum1) as total,(number) as numbers FROM table1 natural join table_detail where t_date BETWEEN '$date' AND '$date2' AND t_time = '$time' group by colum1 having total>1 order by total desc LIMIT 5";
$query = mysql_query($sql) or die(mysql_error());
$num = mysql_num_rows($query);
for($i=1;$i<=$num;$i++)
{
$row = mysql_fetch_array($query);
$intnum = $row['numbers'];
$countt = $row['total'];
}