table-test的名称
Id Name Profession
1 a Engg
2 b Engg
3 c Doctor
4 d Doctor
期望的输出:
Id Name Profession
1 a Engg
4 d Doctor
我想获得包含独特专业的行,如上表所示。我试过了
hql-
"从测试中选择不同的职业"
它正在返回String行业。我怎样才能获得整排?
答案 0 :(得分:2)
DISTINCT
将仅返回具有唯一值的列。
而不是:
select distinct profession from test
使用以下hql查询:
select * from test group by profession