Hi, I have made the sql out and is working, but I need to generate the queryover.
There are several relationships. This return is for a subquery and the sum is for a list that has not always record but may also exist records with zero values. Thank you, I have solved this case in bold, but is ignoring the "Having" and generating "And" Having *(sum (value) == 0) OR (sum (value) IS NULL);* using: .Where(Restrictions.Eq(Projections.Sum<MinhaClasse>((x) => x.Valor), 0) || Restrictions.IsNull(Projections.Sum<MinhaClasse>((x) => x.Receita))) maybe use a coalesce Em quinta-feira, 7 de maio de 2015 09:42:05 UTC-3, sql-expert escreveu: > > Hi: > > *OR* (sum(valor) IS NULL > Why are you testing the result of an aggregate function, especially SUM > for NULL? In SQL, aggregate functions like sum() normally ignore NULLs. > sum(x) should normally never return NULL. If you do get NULLs at the C# > level, there are several ways to handle that. > > HTH. > > On Thu, May 7, 2015 at 6:29 AM, Michael Powell <[email protected] > <javascript:>> wrote: > >> English please. Thank you. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "nhusers" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> Visit this group at http://groups.google.com/group/nhusers. >> For more options, visit https://groups.google.com/d/optout. >> > > -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/nhusers. For more options, visit https://groups.google.com/d/optout.
