Difference between revisions of "Sales queries"

From FreekiWiki
Jump to navigation Jump to search
 
Line 44: Line 44:
  
 
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;
 
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;