Difference between revisions of "Sales queries"

From FreekiWiki
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...)
 
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
==Useful Info for Queries==
 
==Useful Info for Queries==
 
Job IDs:
 
Job IDs:
 +
 +
===Directly Store Related===
  
 
*Sales Admin - 124
 
*Sales Admin - 124
 
*Safari - 111
 
*Safari - 111
 
*Thrift Store - 16
 
*Thrift Store - 16
*Meeting Prep - 108
 
 
*Meeting - 118
 
*Meeting - 118
 
*Thrift Store Admin - 135
 
*Thrift Store Admin - 135
 
*Online Sales - 68
 
*Online Sales - 68
  
Worker IDs:
+
===Not Directly Store Related===
 +
 
 +
*Meeting Prep - 108
 +
*Supply Check - 13
 +
*Reply to Email - 69
 +
*Meeting Prep - 108
 +
*Documentation - 112
 +
*Training - 117
 +
 
 +
 
 +
===Worker IDs:===
  
 
*Leah - 70001
 
*Leah - 70001
Line 21: Line 32:
 
*E-beth - 60002
 
*E-beth - 60002
 
*Sophia - 12386
 
*Sophia - 12386
 +
*Santiago - 70002
  
 
==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;
 +
 +
[[Category: Thrift Store]]

Latest revision as of 13:37, 26 January 2011

Useful Info for Queries

Job IDs:

Directly Store Related

  • Sales Admin - 124
  • Safari - 111
  • Thrift Store - 16
  • Meeting - 118
  • Thrift Store Admin - 135
  • Online Sales - 68

Not Directly Store Related

  • Meeting Prep - 108
  • Supply Check - 13
  • Reply to Email - 69
  • Meeting Prep - 108
  • Documentation - 112
  • Training - 117


Worker IDs:

  • Leah - 70001
  • Ian - 53617
  • Tony - 60007
  • Paco - 50838
  • Mike - 70017
  • Luiz - 31639
  • Sergio - 34779
  • E-beth - 60002
  • Sophia - 12386
  • Santiago - 70002

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;