Hi Oscar, The posted query is the simple one, the motto behind posting such example is to ask whether such kind of query can be generated in nhibernate of not using criteria api.
In practical scenario the inner query is more complicated and it will contains dynamic part instead of (select id from users where userid = 12345') as id this query and now whatever is selected I should be able to apply aggregation on these selected values that is what I am trying to achieve. Please let me know if you can point of something. On Feb 15, 6:55 pm, Oskar Berggren <[email protected]> wrote: > I don't see the point of users subquery in that - there is no > correlation to the outer query so it will return the same value for > every row. > > So it seems do boil down to something like (HQL): > select p.firstname, p.name, count(p) from Person p group by p.firstname, > p.name > > /Oskar > > 2012/2/15 Itzik Saban <[email protected]>: > > > > > > > > > Subqueries in HQL. > > > בתאריך 15 בפברואר 2012 08:20, מאת Nikhil Ketkar <[email protected]>: > > >> Hi, > > >> I am stuck with a problem where I need to do something like below in > >> nhibernate, > > >> select rs.FirstName, rs.name, COUNT(rs.id) from > >> ( > >> select firstname, lastname, (select id from users where userid = > >> 12345') as id > >> from person p > >> ) rs > >> group by rs.firstname, rs.name > > >> How I can achieve this in nhibernate? > > >> Thanks, > >> NK > > >> -- > >> You received this message because you are subscribed to the Google Groups > >> "nhusers" group. > >> To view this discussion on the web visit > >>https://groups.google.com/d/msg/nhusers/-/fmLr_YIN3FYJ. > >> 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. > > > -- > > Itzik Saban > > > my blog > > > -- > > 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. -- 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.
