tags:

views:

28

answers:

1

hi all. I have the following query which I would like to write using the criteria api of NH.

select status, count(1) from (select distinct Status, post_id from post_statistics) tbl group by status

each post_id can exist multiple times in post_statistics

e.g.

id post_id status 1 1 open 1 1 edit 1 1 open 1 2 open

so the query should return the following results:

status count open 2 edit 1

thx in advance.

A: 

mappings, classes? if i'm thinking right, with a proper mapping this would effectively be something like

(pseudo-HQL)

select stat.Name, count(stat.Posts) from status stat
Jaguar
thanks Jaguar, I was asking about ICriteria. I know i can do it in HQL.
Yannis
mappings and classes?
Jaguar