I have two tables: state and nelelist.
condition
name list
--------------- id|Name |stateid -------------- 1|aaa |1 2|abb |1 3|ccc |2 4|dds |2
I want the result table to be
I want to get the above result using linq query
I tried to execute the code below, but returns an as error (It is not possible to create a constant value of type "xxx". In this context, only primitive or enumeration types are supported.)
var count= (from n in bc.db.state select new { states = n.state, count = (from c in bc.db.namelist where c.stateid == n.id select n).Count() });
Does anyone know how to solve this problem?
source share