header('Content-Type: text/html; charset=tis-620');
echo "";
include('db_config.php');
mysql_query("TRUNCATE TABLE tmpkap4");
mysql_query("insert into tmpkap4 (SELECT * FROM $_data where g+s+b+a>0
group by kd_sch,kd_code,g,s,b,a)");
$sql="select kd_code, kd_sch,sname,scode,abb_sch,sum(g) as go,sum(s) as sv,
sum(b) as bn,sum(a) as ad
from tmpkap4,$_sch where kd_sch=scode
group by scode order by go DESC,sv DESC,bn DESC,ad DESC limit 0,20";
$result=mysql_query($sql);
echo "