【发布时间】:2011-10-27 05:39:20
【问题描述】:
在加入期间,我得到下表(示例):
+----------+----------+
| Hostname | Severity |
+----------+----------+
| host1 | high |
| host2 | medium |
| host1 | high |
| host2 | low |
| host1 | low |
| host2 | low |
| host1 | low |
| host2 | high |
| host1 | high |
| host2 | high |
+----------+----------+
是否可以创建我得到以下结果的 JPQL 查询:
+----------+------+--------+-----+
| Hostname | high | medium | low |
+----------+------+--------+-----+
| host1 | 3 | 0 | 2 |
| host2 | 2 | 1 | 2 |
+----------+------+--------+-----+
我尝试使用 COUNT 和 GROUP BY,但得到了类似的结果:
host1,high,3
host1,medium,0
host1,low,2
等等……
BR,雷内
【问题讨论】: