I don't have sure, but thinking in OOP SELECT (SELECT COUNT(*) FROM Object1) + 1 FROM Object2
The subselect in green, are not an Numerical object yet, the HQL parser does't know yet whats comming, so, it can't make arithmetical operations outside of a subselect. btw I tried this query: SELECT CAST((SELECT COUNT(*) FROM Object1) AS INT) + 1 FROM Object2 casting the value to int, and then, + 1. it works in mssql --- Vision without action is a waking dream. Action without vision is a nightmare. On Mon, Oct 26, 2009 at 7:15 PM, Sandro Micael <[email protected]>wrote: > Yes, that way it's working :) thanks. > By the way could you explain me why the way I was doing before was wrong? > > > 2009/10/26 Fernando Zago <[email protected]> > > try this: >> >> SELECT >> (SELECT count(*) + 1 FROM Object1), >> 1 + 1 >> FROM Object2 >> >> --- >> Vision without action is a waking dream. >> Action without vision is a nightmare. >> >> >> >> On Mon, Oct 26, 2009 at 3:26 PM, Dryadwoods <[email protected]>wrote: >> >>> >>> I'm using NH v2.1.0.4000. >>> I have this query that runs correctly: >>> >>> SELECT >>> (SELECT count(*) FROM Object1), >>> 1 + 1 >>> FROM Object2 >>> >>> >>> Then I try to run this query: >>> >>> SELECT >>> (SELECT count(*) FROM Object1) + 1, >>> 1 + 1 >>> FROM Object2 >>> >>> and I get an exception. >>> For what I can observe the "1+1" is working, but the count() + 1 trown >>> an Antlr.Runtime.NoViableAltException >>> I need to make math with the result of some select counts. >>> >>> Am I doing something wrong or there is a bug here? >>> Thanks for the help >>> >>> >>> >> >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
