我有一个sql语句,我无法正确地获取结构,当我运行我目前拥有的时它说语法错误。我看的结果看起来像这样: -
Valid XHTML http://www.churchcom.co.uk/test/Capture2.JPG
到目前为止,这是我的查询,但我不认为我在正确的轨道上。
SELECT Name, ValueofTaught, Amount
FROM Activities
WHERE (Department = @Department)
ORDER BY Name
GROUP BY BurnhamGrade
(SUM ValueofTaught AND Amount
WHERE Departmetn = @Department)
活动的结构表如下: -
答案 0 :(得分:2)
听起来有点像group by
两列。我假设Value of Taught
列是卷起几个小时的内容:
SELECT Department, Name, SUM([Value of Taught]) Hours, SUM(Amount) Pay
FROM Activities
GROUP BY Department, Name
ORDER BY Department, Name
WITH ROLLUP