[求助]嵌套查询很慢,怎么办?
$query = "SELECT * FROM test1";
$result = mysql_query($query);
while ($data = mysql_fetch_assoc($result)) {
$query1 = "SELECT * FROM test2 WHERE id = " . $data['id'];
$result1 = mysql_query($query1);
while ($data1 = mysql_fetch_assoc($result1)) {
}
}
我现在的程序需要用到像这样的多数据表的查询,但像上面一样写出来的程序太慢了,谁有比较快的查询方法?
谢谢