我有这三个查询,我需要合并为一个。
$sql = "SELECT SUM(datamb) AS value_sum FROM maindata GROUP BY phonenumber";
$sql1 = "select dataplan as currentplan from maindata GROUP BY phonenumber";
$sql2 = "SELECT DISTINCT phonenumber AS value_sum1 FROM maindata";
所以我可以像这样在三列中显示它们:
while ($row = mysql_fetch_assoc($result)){
echo "<TABLE id='display'>";
echo "<td><b>Data Usage This Period: ". ROUND ($row["value_sum"],2) . "MB</b></td> ";
echo "<td><b>Data Plan: ". $row["currentplan"] . "</b></td> ";
echo "<td><b>Phone Number: ". $row["phonenumber"] . "</b></td> ";
echo "</TABLE>";
}
我使用了 UNION,它只制作了一个大列,其中所有数据都正确接近,但我需要它们全部显示在一个表中的三列中。谢谢你的任何想法,如果你认为我应该打自己的脸,已经完成了:)