Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3112570
  • 博文数量: 1412
  • 博客积分: 15478
  • 博客等级: 上将
  • 技术积分: 14938
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-23 16:08
文章存档

2016年(1)

2015年(17)

2013年(13)

2012年(103)

2011年(185)

2010年(261)

2009年(425)

2008年(363)

2007年(44)

分类: 数据库开发技术

2009-06-20 21:39:50

分组查询--group by
select stuClass,stuName,stuSubject from studentScore group by stuName,stuSubject,stuClass
一般用在聚合函数,如看看每个班有多少人
select count(stuClass) from studentScore group by stuClass

分组后再进行筛选--having 如分完组成不想看到己查出的某列,可进行再次筛选,加入having claName!='计算机五班'
select claName,count(stuClass) from studentScore ,stuClass where stuClass=claID group by stuClass,claName having claName!='计算机系五班'
阅读(1610) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~