An SQL query is simple:
select
*
from [Order] o
where
3 <= DATEDIFF( hour , ( select top 1 CreatedAt from [Order] oi where
oi.CustomerId = o.CustomerId order by CreatedAt ), o.CreatedAt );
However, i was not able to write its LINQ analog
The only idea i have is
Session.Query<Order>.Where( x => x.CreatedAt - new TimeSpan( 0, 3, 0 )
>
Session.Query<Order>
.Where( y => y.Customer == x.Customer )
.OrderBy( y => y.CreatedAt )
.First()
.CreatedAt
);
but it gives me an excpetion "Unable to cast object of type
'Antlr.Runtime.Tree.CommonTree' to type
'NHibernate.Hql.Ast.ANTLR.Tree.IASTNode'."
--
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.