Can you please provide full queryover you are trying to build?

Best Regards,
Alexander

On Friday, 8 May 2015 01:49:40 UTC+12, glautter neves wrote:
>
> Sorry, confused with another group.
>
> 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
>
>
> translated text below:
>
> Hello,
>
> Does anyone have any tips to put together a queryover with the Having 
> clause, but with two conditions?
>
> ex .:
> group by ...
> Having (sum (value) == 0) OR (sum (value) IS NULL);
>
>
> I've done like this:
> .Where (Restrictions.Eq (Projections.Sum <MyClass> ((x) => x.Valor), 0)))
> SQL generated:
> group by ...
> Having (sum (value) == 0)
>
> I've done like this:
> .Where (Restrictions.Or (Restrictions.Eq (Projections.Sum <MyClass> ((x) 
> => x.Valor), 0)
>                                        Restrictions.Eq (Projections.Sum 
> <MyClass> ((x) => x.Valor), null));
> SQL generated:
> Error: Object reference not set to an instance of an object. Because the 
> value that I'm comparing is null.
> Yet the value "Restrictions.Or" will return me out of the "Having". It 
> will be an "And".
>
> What I need is that the second option (Restrictions.Eq (Projections.Sum 
> <MyClass> ((x) => x.Valor), null)) bring me sum (amount) is null;
>
> Does anyone have any tips?
>
> I thank you
> Em quinta-feira, 7 de maio de 2015 08:11:26 UTC-3, Michael Powell escreveu:
>>
>> 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].
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.

Reply via email to