I did say that I'm using v1.2.1 right ? There's no SetMaxResults on DetachedCriteria.
I ended up using 2 separate queries - not ideal but it will do. Thanks anyway. On Mar 10, 2:25 pm, Fabio Maulo <[email protected]> wrote: > SetMaxResults > > 2009/3/10 sirrocco <[email protected]> > > > > > > > I can live without the group by, but how do I set a top 1 ? > > > I'm using v1.2.1.4000. - I see that there is a setMaxResults in the > > trunk - is there no way in v1.2.1.4000 to do this ? > > > On Mar 10, 11:19 am, sirrocco <[email protected]> wrote: > > > SELECT * FROM ProductRenameHistory this_ > > > WHERE this_.HistoryKey = > > > (SELECT Top 1 this_0_.HistoryKey as y0_ > > > FROM ProductRenameHistory this_0_ > > > WHERE this_0_.WasRolledback = 0 > > > GROUP BY this_0_.HistoryKey , this_0_.RecordStamp > > > ORDER BY this_0_.RecordStamp desc) > > > > The above query is what I'm trying to accomplish. This is what I have. > > > How do I put a top 1 in there. And, how do I select only the > > > HistoryKey ?(and not RecordStamp too). > > > > DetachedCriteria lastRename = DetachedCriteria.For(typeof > > > (DetachedCriteria)); > > > lastRename.Add(Expression.Eq("WasRolledback", false)); > > > lastRename.AddOrder(Order.Desc("RecordStamp")); > > > lastRename.SetProjection(Projections.ProjectionList() > > > .Add(Projections.GroupProperty > > > ("HistoryKey")) > > > .Add(Projections.GroupProperty > > > ("RecordStamp")) > > > ); > > -- > Fabio Maulo --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
