c# - How Can I Generate Nhibernate GROUP BY without SELECT the property -


i'd resolve problem :

select max(date) table group subid 

(then pass subquery mid-action can id of item in table)

select id table date in [[[ previous request ]]] 

(then full table item other table join)

select * table left join... id in [[[ previous request ]]] 

i tried kind of request :

var subquery = queryover.of<table>(() => x)                     .selectlist(list => list                     .selectmax(() => x.date)                     .selectgroup(() => x.sub.id)                 );                  var filter = queryover.of<table>().withsubquery.                     whereexists(subquery)                     .select(p => p.id);                  var result = session.queryover<table>().withsubquery.whereproperty(p => p.id).in(filter).left.joinqueryover(p => p.sub).list(); 

but problem can't first request right date out of request. there better way kind of subqueries ? , there possibility in nhibernate groupy property without selecting ?

thanks !

finally did way , generated sql wanted. wasn't 3 subqueries 3 queries looking in set of datas (the arrays subquery , correspondingids).

var subquery = session.queryover<table>(() => x)                     .selectlist(list => list                     .selectmax(() => x.date)                     .selectgroup(() => x.sub.id))                     .list<object[]>().select(p => p[0]).toarray();                   var correspondingids = session.queryover<table>(() => x)                     .whererestrictionon(() => x.date).isin(subquery)                     .select(p => p.id).list<int>().toarray();                  var result = session.queryover<table>(() => x).whererestrictionon(() => x.id).isin(correspondingids).left.joinqueryover(p => p.sub).list(); 

Comments

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -