这是我的表,
+-----------------|---------------|--------------------|---------------|
id | hostName | timestamp | memToal |
------------------------------------------------------------------------
1 | A | 1402643486558 | 1891852 |
------------------------------------------------------------------------
2 | B | 1402643486558 | 1891852 |
------------------------------------------------------------------------
3 | A | 1402643486558 | 1891852 |
------------------------------------------------------------------------
4 | C | 1402643486558 | 1891852 |
------------------------------------------------------------------------
我想获取与每个不同列值相关的所有信息,但我只知道运行时的主机名。任何人都可以建议一种方法吗?
答案 0 :(得分:0)
我想你想要这个:
select
hostName,
group_concat(distinct timestamp) timestamps,
group_concat(distinct memToal) memTols
from mytable
group by hostName