select b.xymc as 学院名称, c.zymc as 专业名称,d.count1 as 已报到人数,e.count2 as 未报到人树,d.count1/e.count2 报到率 from xsxxb a,bmb b,zyb c, (select xydm,zydm,count(*) as count1 from xsxxb where bdbj='y' group by xydm,zydm) d, (select xydm,zydm,count(*) as count2 from xsxxb where bdbj='n'group by xydm,zydm) e where a.xydm*=b.xydm and a.zydm*=c.zydm and (a.xydm=d.xydm and a.zydm=d.zydm) and (a.xydm=e.xydm and a.zydm=e.zydm)
有个小错误 select b.xymc as 学院名称, c.zymc as 专业名称,d.count1 as 已报到人数,e.count2 as 未报到人树,d.count1/e.count2 报到率 from xsxxb a,bmb b,zyb c, (select xydm,zydm,count(*) as count1 from xsxxb where bdbj='y' group by xydm,zydm) d, (select xydm,zydm,count(*) as count2 from xsxxb where bdbj='n'group by xydm,zydm) e where a.xydm*=b.xydm and a.zydm*=c.zydm and (a.xydm*=d.xydm and a.zydm*=d.zydm) and (a.xydm*=e.xydm and a.zydm*=e.zydm)
int iCount = 0;
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
iCount += int.Parse(ds.Tables[0].Rows[i]["num"].RoString());
}
foreach (DataGridItem item in DataGrid1.Controls[0].Controls)
{
if (item.ItemType == ListItemType.Footer)
{
item.Cells[0].Text = iCount.ToString();
return;
}
}
DataGrid1.Columns(0).FooterText=strSum
DataGrid1.Columns(1).FooterText=strCount
DataGrid1.DataBind()
当然,strSum和strCount需要你自己算好。
from xsxxb a,bmb b,zyb c,
(select xydm,zydm,count(*) as count1 from xsxxb where bdbj='y' group by xydm,zydm) d,
(select xydm,zydm,count(*) as count2 from xsxxb where bdbj='n'group by xydm,zydm) e
where a.xydm*=b.xydm and a.zydm*=c.zydm
and (a.xydm=d.xydm and a.zydm=d.zydm)
and (a.xydm=e.xydm and a.zydm=e.zydm)
select b.xymc as 学院名称, c.zymc as 专业名称,d.count1 as 已报到人数,e.count2 as 未报到人树,d.count1/e.count2 报到率
from xsxxb a,bmb b,zyb c,
(select xydm,zydm,count(*) as count1 from xsxxb where bdbj='y' group by xydm,zydm) d,
(select xydm,zydm,count(*) as count2 from xsxxb where bdbj='n'group by xydm,zydm) e
where a.xydm*=b.xydm and a.zydm*=c.zydm
and (a.xydm*=d.xydm and a.zydm*=d.zydm)
and (a.xydm*=e.xydm and a.zydm*=e.zydm)