将mysql数据单行输出到屏幕

将mysql数据单行输出到屏幕,mysql,Mysql,我有一个专栏: Id attrib value "id1" "Router" "New York" "id2" "Router" "New York" "id3" "Router" "New York" "id4" "Router" "New York" 我怎么可能只选择一次attrib和attrib_值而用se

我有一个专栏:

Id          attrib                value
"id1"      "Router"             "New York"
"id2"      "Router"             "New York"
"id3"      "Router"             "New York"
"id4"      "Router"             "New York"
我怎么可能只选择一次
attrib
attrib_值
而用select语句包含所有相关Id?比如:

"Router"   "New York"   “id1, id2, id3, id4”
我试过一些方法,但我甚至不知道在网上搜索什么。。下面是我所能看到的

直接选择会以标准格式给出值:

select id, attrib, attrib_value from table where attrib=Router
使用
group\u concat()


如果合适,考虑在应用程序中处理数据显示的问题。code@Strawberry谢谢,这里的问题是它需要从脚本语言外部查询,所以下面的答案解决了我的问题。谢谢你的回复,非常感谢。
select group_concat(id), attrib, attrib_value from table 
where attrib='Router'