http://www.hibernate.org/hib_docs/nhibernate/html/queryhql.html 11.5.
is about aggregates. the query would look something like
select
               r.Time,
               min(v.number),
               (select max(x.number) from Values x where x.record_id =
r.id and x.number > min(v.number))
from Record r join Values v
where r.id in :array_of_ids

since this is an aggregate you can load it into a collection 1 of 2
ways.
1. using an object array
2. using a transformer to load each row into a value object


On Jan 2, 8:43 am, Utopico <[email protected]> wrote:
> Hi
>
> I have not much experience with crosstab queries (pioting). I did som
> research on the net, but could not find andy good examples on how to
> do this through HQL and hibernate. Thus I was wondering if I could get
> some help with my problem.
>
> I have two tables:
> datarecord: (id, time) where id is PK
> datavalue(id,rec_id,value,type) where id is PK and rec_id and type_id
> is FK.
>
> Record example:
> 1 - 12:00:00
> 2 - 16:00:00
>
> Values:
> 1 - 1 - 4.5 - A
> 2 - 2 - 6.5 - A
> 3 - 2 - 6.7 - C
> 4 - 2 - 7.7 - B
> 5 - 2 - 1.7 - C
>
> Then I would like to make a query that select specific types and get
> value of the specific type in its seprate column.
> Example result when requesting the value of type A and B (not
> including C) would be:
> (time, value of A, value of B)
> 12:00:00 - 4.5 - null
> 16:00:00 - 6.5 - 7.7
>
> The number of types that can be selected is dynamic since the query
> would be used from a userinterface to select which data to view in
> graphs.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to