asp.net - Linq to SQL: select additional count -
i want select table add additional column holding count() of other rows in table. how can that? groupby not i'm looking think. want in sql:
select *,(select count(*) tablename2 y=1) count tablename x = 1
i found solution:
context.tablename.where(y>y.column.equals(1)) .select(x=>new{object=x,count = context.tablename2.count()})
will generate this:
select *, (select count(*) tablename2) tablename tablename.y = 1
Comments
Post a Comment