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

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -