PHP在列中显示具有相同值的id

时间:2015-05-14 23:42:24

标签: php mysql

你好,所以这个表有一些相等的值

enter image description here

到目前为止,这是我的查询

$stmt = $dbc->query("SELECT weight, GROUP_CONCAT(id) AS ids FROM tbl_weight GROUP BY weight HAVING COUNT(*) > 1");
    while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
        echo $row['ids'] . "<br />"; 
    }

运行此查询时的输出是

enter image description here

我真正想要的是这样的 enter image description here

这怎么可能?

0 个答案:

没有答案
相关问题