Difference between revisions of "Sales queries"
Jump to navigation
Jump to search
(New page: ==Useful Info for Queries== Job IDs: *Sales Admin - 124 *Safari - 111 *Thrift Store - 16 *Meeting Prep - 108 *Meeting - 118 *Thrift Store Admin - 135 *Online Sales - 68 Worker IDs: *Lea...) |
|||
Line 23: | Line 23: | ||
==Queries== | ==Queries== | ||
− | Total of Monthly XX hours logged (fill in job_id): | + | *Total of Monthly XX hours logged (fill in job_id): |
SELECT EXTRACT (MONTH FROM worked_shifts.date_performed) AS Monthly, SUM (duration) | SELECT EXTRACT (MONTH FROM worked_shifts.date_performed) AS Monthly, SUM (duration) | ||
FROM worked_shifts WHERE date_performed BETWEEN ('2010-01-01') AND ('2010-12-31') | FROM worked_shifts WHERE date_performed BETWEEN ('2010-01-01') AND ('2010-12-31') | ||
AND job_id ='XX' GROUP BY 1 ORDER BY Monthly ASC; | AND job_id ='XX' GROUP BY 1 ORDER BY Monthly ASC; | ||
+ | |||
+ | *Total of Monthly XX hours logged for XXXXX worker (fill in job_id and worker_id): | ||
+ | |||
+ | SELECT EXTRACT (MONTH FROM worked_shifts.date_performed) AS Monthly, SUM (duration) FROM worked_shifts WHERE date_performed BETWEEN ('2010-01-01') AND ('2010-12-31') AND job_id = 'XX' AND worker_id = 'XXXXX' GROUP BY 1 ORDER BY Monthly ASC; |
Revision as of 13:35, 22 January 2011
Useful Info for Queries
Job IDs:
- Sales Admin - 124
- Safari - 111
- Thrift Store - 16
- Meeting Prep - 108
- Meeting - 118
- Thrift Store Admin - 135
- Online Sales - 68
Worker IDs:
- Leah - 70001
- Ian - 53617
- Tony - 60007
- Paco - 50838
- Mike - 70017
- Luiz - 31639
- Sergio - 34779
- E-beth - 60002
- Sophia - 12386
Queries
- Total of Monthly XX hours logged (fill in job_id):
SELECT EXTRACT (MONTH FROM worked_shifts.date_performed) AS Monthly, SUM (duration) FROM worked_shifts WHERE date_performed BETWEEN ('2010-01-01') AND ('2010-12-31') AND job_id ='XX' GROUP BY 1 ORDER BY Monthly ASC;
- Total of Monthly XX hours logged for XXXXX worker (fill in job_id and worker_id):
SELECT EXTRACT (MONTH FROM worked_shifts.date_performed) AS Monthly, SUM (duration) FROM worked_shifts WHERE date_performed BETWEEN ('2010-01-01') AND ('2010-12-31') AND job_id = 'XX' AND worker_id = 'XXXXX' GROUP BY 1 ORDER BY Monthly ASC;