<?php
require_once "include/config.php";$sql = "select distinct fb_bamodel from tblb_battery where fb_bacode in (select distinct fb_bacode from tblbatob_ba where fbatterycode='CB7310B.40H') and fclasscode='1' and fb_babrand='IBM'";
$result = @mysql_query($sql);
$row = @mysql_num_rows($result);
if ($row > 0)
{
while ($arr = @mysql_fetch_array($result))
{
echo $arr[0]."<br>";
}
}
?>
我换了种测试方法,版本是mysql5.0,能查询出,在本机测试,但第一次查询很慢,大概要20多秒,但刷新就很快了,http://localhost/test.php,开新窗口也很快,换了几个浏览器测试都很快,但就是第一次查询慢,比如说把"IBM"改为“COMPAQ”再查询就很慢了,但如重复上次查询又会很快
require_once "include/config.php";$sql = "select distinct fb_bamodel from tblb_battery where fb_bacode in (select distinct fb_bacode from tblbatob_ba where fbatterycode='CB7310B.40H') and fclasscode='1' and fb_babrand='IBM'";
$result = @mysql_query($sql);
$row = @mysql_num_rows($result);
if ($row > 0)
{
while ($arr = @mysql_fetch_array($result))
{
echo $arr[0]."<br>";
}
}
?>
我换了种测试方法,版本是mysql5.0,能查询出,在本机测试,但第一次查询很慢,大概要20多秒,但刷新就很快了,http://localhost/test.php,开新窗口也很快,换了几个浏览器测试都很快,但就是第一次查询慢,比如说把"IBM"改为“COMPAQ”再查询就很慢了,但如重复上次查询又会很快
"select distinct fb_mamodel from tblb_machine where fb_macode='8616'"
"select distinct fb_macode from tblb_matoba where fbatterycode='CL740B.862'"
查询都很正常,但一组合就不行了,电脑会变得相当慢,结束mysqld-nt.exe就行了请各位帮帮我
接下来快,是应为数据是从高速缓冲区中取得的,不需要I/O操作如果组合起来,查询很慢的话,就把他分开来
我有个笨方法,不知行不,把第一条查询结果用一个while循环拼成第二条查询语句,执行第二条语句
$result = @mysql_query($sql4pre);
$a=array();
while ($arr = @mysql_fetch_array($result))
{
$a[]=$arr[0];
}$sql4 = "select distinct fb_bamodel from tblb_battery where fb_bacode in (".join(",",$a).") and fclasscode='1' and fb_babrand='$fb_babrand'";
$result4 = @mysql_query($sql4);
$num4 = @mysql_num_rows($result4);