我有一个这样的结果集:
Platform Set Total
WinY1-23 OT 12
WinY1-23 TT 22
WinY1-23 OR 13
WinY1-23 OY 142
Total_WS OT 12
Total_WS TT 12
Total_WS OR 13
基本上,这是一个通过 Platform
、Set
进行分组的查询。我希望能够在每个平台中显示每个集合及其总数。希望这是有道理的。
有没有办法只显示一次 Platform
及其下的集合?
在 SSRS 中,我们可以显示类似的内容,因为报告为每个平台类型显示 +
符号。我们可以用 PHP 来做这个吗?或者通过任何其他方式?
谢谢。
最佳答案
假设你想要的是这样的:
$platform = '';
foreach($resultSetArray as $row){
// if platform is different from previous one
// display platform
if($row['platform'] != $platform){
echo $row['platform'];
$platform = $row['platform'];
}
echo $row['otherStuff'];
}
WinY1-23
OT 12
TT 22
OR 13
OY 142
Total_WS
OT 12
TT 12
OR 13
关于php - 如何在php中按每种类型一次显示mysql数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2374207/