我想从两个相邻的不同表中提取列。
我有如下的php代码:
<table>
<tr>
<th>Date</th>
<th>Performance A </th>
<th>Performance B </th>
</tr>
$sql = "select date, Aperformance from table1 group by date";
$sql1 = "select date, Bperformance from table2 group by date";
$result = mssql_query($sql);
while ($column = mssql_fetch_array($result))
{
echo "<tr><td>".$column[0]."</td>";
echo "<td>".$column[1]."</td></tr>";
}
这会产生如下输出:
Date | Performance A | Performance B
01/05/12 | 40% |
02/05/12 | 30% |
03/05/12 | 25% |
现在我想从查询 $sql1 中填写第三列。我不想要 $sql1 中的日期列,第二列 Bperformance 需要放在这里。我怎么能这样做?