我有一个有两列的表,像这样的状态和贷款
State loan
NJ 100
CA 200
NJ 150
CT 300
CT 100
我想使用 linq 按州对贷款进行分组。我已经这样做了,但它不起作用
var query = from address in context.data_vault.ToList()
group address by address.STATE into addressGroup
select new
{
State = addressGroup.Key,
count = addressGroup.Count()
};
我还需要对结果进行分页。
请建议我怎么做