1

このクエリは、「個別」または「順序付け」を削除すると機能しますが、組み合わせて機能しません。私は例に従おうとしています。これを説明してもらえますか?

String queryString = "select distinct event.county from Event as event order by event.county.county"

[main] - [ERROR] SqlExceptionHelper.logExceptions():144 >> ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list
  Position: 215

生成されたSQL

select distinct county1_.Id as Id4_, county1_.County as County4_ from Event event0_ inner join County county1_ on event0_.CountyID=county1_.Id cross join County county2_ where event0_.CountyID=county2_.Id order by county2_.County 
4

1 に答える 1

7

で試してみてください

select distinct county from Event event
inner join event.county county
order by county.county
于 2012-11-14T14:26:40.430 に答える