悬赏园豆:5
[已解决问题]
解决于 2008-08-29 09:00
<P>小弟刚着手学习Linq,脑袋好象有些转不过来弯,大家帮忙写个语句吧,谢谢了,表结构如下:</P>
<P>BigClass表<BR>b_id name<BR>1 软件工程<BR>2 软件测试<BR>3 数据库开发</P>
<P>News表<BR>id title content time b_id(外键)<BR>1 title1 fasdfs null 2<BR>2 title1 fasdfs null 1<BR>3 title1 fasdfs null 2<BR>4 title1 fasdfs null 3<BR>5 title1 fasdfs null 2<BR>6 title1 fasdfs null 3<BR>7 title1 fasdfs null 1</P>
<P>查询出如下结果:<BR>b_id name number<BR>1 软件工程 2<BR>2 软件测试 3<BR>3 数据库开发 2</P>
<P>SQL语句实现很简单:<BR>select b.b_id as id,b.name as name,count(n.b_id) as number <BR>from news as n,bigclass as b<BR>where n.b_id=b.b_id<BR>group by n.b_id,b.b_id,b.name<BR><BR>由于刚开始学Linq,希望大家帮帮忙写下实现这个功能的Linq,谢谢了!</P>