I’m trying to create SQL Query to show task under one project and how many hours spent on each task month by month ?
Query
SELECT
Projects.projectName, Tasks.taskName,
billingsTimes.taskID, billingsTimes.actualTotalTime
FROM Projects
INNER JOIN Projects_tasks ON Projects.projectID = Projects_tasks.projectID
INNER JOIN Tasks ON Projects_tasks.taskID = Tasks.taskID
INNER JOIN billingsTimes ON Tasks.taskID = billingsTimes.taskID
WHERE (Projects.projectID = '')
Sounds like you just need the following:
If you provide more details about where the monthly dates are stored, then this could be altered to group by month to give you monthly totals per task.
edit #1, if you are using the
dateOfServiceto determine when the service was performed and you want to group by month/year, then you can use the following: