我有 2 个具有相同字段名称的表,我想显示来自两个字段列的记录。
Table_a
id date user test
1 2013-08-08 Adam Various
2 2013-08-08 Paul Record
Table_b
id date user test
1 2013-08-08 Adam Record
2 2013-08-08 Paul Mytest
$sql = "Select Table_a.date, Table_a.user, Table_a.test, Table_b.date, Table_b.user, Table_b.test FROM table_a, Table_b where Table_a.user like table_b AND table_a.Date = table_b.date AND table_b.Date = '".date("Y-m-d", strtotime("today"))."'";
$result = mysql_query($sql);
$row = mysql_fetch_assoc($result);
echo "<p'><b>" . $row['user'] . "</b></p>";
echo "<p><b>". $row['test'] ."</b></p>";
echo "<p><b>". $row['test'] ."</b></p>";
例如,我希望结果是 Adam -various -record。也就是说,我希望第三个回"<p><b>". $row['test'] ."</b></p>";
显显示来自 table_b 的记录。
谢谢