I want to sum the computed column Red, which is computed in the IsRed () function, which returns an integer.
When I run the query, I get the following error: the 'Int32 IsRed (Int32)' method does not support SQL translation.
How do I rewrite this to make it work. Thank.
From xx In
(From l In L3s
Join a In BLs On l.L3ID Equals a.L3ID
Order By l.ID
Select PID = l.ID,
Red = IsRed(a.D1.Day- l.D2.Day))
Group By Key = xx.PID Into G = Sum(xx.Red)
Select Key, G
Function IsRed(ByVal dayx As Integer) As Integer
If (dayx < -7) Then
Return 1
Else
Return 0
End If
End Function
source
share