是否可以在一个查询中从多个表中检索一组数据?例如,我从 table1 获取一个数组,但我也想从其他几个表中检索数据:
<?php
$con = mysql_connect($hostname,$username, $password);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db($dbname, $con);
$today = date('Y-m-d H:i:s', time());
$today1DayAgo = date('Y-m-d H:i:s', strtotime("$today -1 day"));
$query = "SELECT * FROM table1 WHERE omtr_date BETWEEN '$today1DayAgo' AND '$today'";
$result = mysql_query($query);
while($row = mysql_fetch_array($result)){
echo $row["omtr_page_view"]);
}
mysql_close($con);
?>
谢谢