1.
CourseIDSQL serverGroup BySQLSelect CourseID, Avg(Score) as From Score
Group By CourseID
SQLSelect StudentID as ,CourseID as , Avg(Score) as
From Score
Group By StudentID,CourseID
Group Byselectselect2.Having“”
Countscore>1Having
SQL
Select StudentID as ,CourseID as ,
Avg(Score) as
From Score
Group By StudentID,CourseID
Having Count(Score)>1
3.—
WHERE
GROUP BY
HAVING
1: “2000 ”
Select , Count(*)
From Where >= 2000
GROUP BY Having Count(*) > 1
2: 0827
Select CAST (DATEPART(YEAR,paytime) as varchar(10))+''+ CAST (DATEPART(MONTH,paytime) as varchar(10))+'' AS ,Sum(CHARGE) From "history-accountbill Where isPaid<>0 AND
paytime between '2008-02-01 00:00:00' and '2008-7-31 23:59:59'
Group By CAST (DATEPART(YEAR,paytime) as varchar(10))+''+ CAST (DATEPART(MONTH,paytime) as Varchar(10))+''
本文出自 “風水雲天--樂成 著” 博客,請務必保留此出處http://yueyuanyuan.blog.51cto.com/1342062/308496