これが私の質問です:
SELECT p.Company
, p.Project_ID
, p.Name as 'Project_Name'
, p.Company
, t.Name as 'Task_Name'
, r.Owner
, t.Status
, r.Work_Date
, r.Minutes_Spent
, r.Type
, r.Description
FROM TK_Project p
INNER JOIN TK_Task t
ON p.Project_ID = t.Project_ID
JOIN TK_Time_Record r
ON t.ID = r.Task_ID
WHERE p.Company = 248
AND p.Name = 'Technical Support'
AND r.Work_Date BETWEEN '01/01/2012' AND '05/02/2012'
AND r.Type NOT LIKE '%non%'
--AND (
-- r.Type = 'Programming-Billable'
-- OR r.Type = 'Consulting-Billable'
-- )
AND (
r.Type = 'Data Maintenance'
OR r.Type = 'Tech Support-Billable'
OR r.Type = 'Training'
)
ORDER BY r.Work_Date DESC
返されるデータは次のとおりです。
Company Project_ID Project_Name Company Task_Name Owner Status Work_Date Minutes_Spent Type Description
------- ---------- ----------------- ------- ----------------- ------- ------- ----------------------- ------------- --------------------- ------------
248 512 Technical Support 248 Technical Support Tim Started 2012-03-06 00:00:00.000 15 Tech Support-Billable Notes.
248 512 Technical Support 248 Technical Support Patrick Started 2012-02-24 00:00:00.000 15 Data Maintenance Notes.
248 512 Technical Support 248 Technical Support Tim Started 2012-02-24 00:00:00.000 15 Tech Support-Billable Notes.
248 512 Technical Support 248 Technical Support Tim Started 2012-02-14 00:00:00.000 15 Tech Support-Billable Notes.
248 512 Technical Support 248 Technical Support Tim Started 2012-01-05 00:00:00.000 15 Tech Support-Billable Notes.
248 512 Technical Support 248 Technical Support Tim Started 2012-01-04 00:00:00.000 15 Tech Support-Billable Notes.
asp.netまたはSQLでMinutes_Spent列の合計を取得するための最良の方法は何ですか?WITH ROLLUPを機能させようとしましたが、正しく機能しませんでした。COMPUTEを試しましたが、複数の結果セットを返すことはできません(asp.netでアクセスする方法はわかりませんが)