Hi all, 

So far I have only written fairly simple nHibernate queries and have a 
relatively complex SQL one that I need to pump out in QueryOver (Icriteria) 
or if that proves too fiddly, HQL. Please find the query below:

Select aliasTable1.Id, AliasTable1.Time, 
       AlaisTable2.Version,
       (select top 1 secondAliasTable1.Time
          from Table1 secondAliasTable1
          where aliasTable1.Time < secondAliasTable1.Time
            AND secondAliasTable1.Time < (SELECT Top 1 thirdAliasTable1.Time 
from Table1 thirdAliasTable1 
                                            where thirdAliasTable1.Name = 
'stringValue1'
                                              AND thirdAliasTable1.Id = 
aliasTable1.Id
                                              AND thirdAliasTable1.Time > 
aliasTable1.Time
                                            ORDER By thirdAliasTable1.Time)
            AND secondAliasTable1.Name = 'stringValue2'
            AND secondAliasTable1.Id = aliasTable1.Id
            ORDER BY secondAliasTable1.Time) As 'Endtime'
  from Table1 aliasTable1
    INNER JOIN Table2 aliasTable2 on AliasTable2.Id = aliasTable1.table2Id
  where alaisTable1.Name = 'stringValue2'
  ORDER BY alaisTable1.Time

I have really hit a wall with this query in the conversion, so I am hoping 
to get at least a starting point to get me going, if not a full answer!

Cheers

-- 
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/-/ypWiGpuHDAoJ.
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