Converting linq query from
i am failing converting this sql to linq ...
hope someone does it.
SELECT Max([PersonalNumber]+1)
FROM TestTable
GROUP BY CalYear
HAVING CalYear=Year(Now())
Thank.
+2
Jack black
source
to share
2 answers
here -> http://blogs.msdn.com/vbteam/archive/2007/12/18/converting-sql-to-linq-part-5-group-by-and-having-bill-horst.aspx
From TestTable in a
Group By CalYear
into CalYear = Year(Now())
+2
solairaja
source
to share
The HAVING clause allows you to filter AGGREGATE results. In this case, you are filtering on the GROUP column, which you can simply filter using the WHERE clause.
Therefore, you don't need to create a HAVING clause in LINQ. A simple WHERE clause will do the same.
+3
Robin day
source
to share