title: Calculate time difference while executing query
body: <p>Query : </p>
  
  <pre><code>SELECT products.product_name ,
  employee.emp_name,employee.emp_code,process.process_name,timer_completed.worked_qty , 
  FROM_UNIXTIME(timer_completed.start/1000,'%d-%m-%Y %H:%i:%s') as start,
  FROM_UNIXTIME(timer_completed.end/1000,'%d-%m-%Y %H:%i:%s') as end , 
  FROM timer_completed
  INNER JOIN com_jobcard ON com_jobcard.id = timer_completed.job_card_id
  INNER JOIN products ON products.id = com_jobcard.product_id    
  INNER JOIN employee ON employee.id = timer_completed.employee_id
  INNER JOIN process ON process.id = timer_completed.process_id
  INNER JOIN carat_percentage ON carat_percentage.id = com_jobcard.carat_id
  INNER JOIN groups ON groups.id = timer_completed.group_id
  INNER JOIN departments ON departments.id = groups.dept_id
  AND departments.id = '40';
  </code></pre>
  
  <p>OUTPUT :</p>
  
  <pre><code>JCID-1151521    PRNG    ARAVINTHAN.N        A4942   Brushing           0    07-07-2015 14:35:10     07-07-2015 14:43:45     
  JCID-1149968    SRNL    Sathya              A4535   Correction          29  07-07-2015 18:06:28     07-07-2015 18:32:33     
  JCID-1149968    SRNL    Sathya              A4535   Inside_Correction   29  07-07-2015 18:32:45     07-07-2015 18:42:44     
  JCID-1149968    SRNL    Pani Paul Prakash   A3100   Lapping          30     08-07-2015 09:16:20     08-07-2015 09:16:46     
  JCID-1149968    SRNL    Pani Paul Prakash   A3100   Nice             30     08-07-2015 13:14:36     08-07-2015 13:37:50     
  </code></pre>
  
  <p>Dear friends from the following query I'll get the result as given below , but my expected result is I've to sum the values of SUM (timer_completed.worked_qty) so that the start time and end time has to be subtracted and the values has to be sum parallel .
  I'll use group by employee.emp_code so the worked qty has to be sum and for each iteration the start time and end time has to be subtracted 
  ((07-07-2015 18:32:45) -(07-07-2015 18:42:44))and finally the sum of worked qty and time taken has to be given as result </p>
  
  <p>expected result is</p>
  
  <pre><code>JCID-1151521    PRNG    ARAVINTHAN.N        A4942   Brushing           0   0:0:35
  JCID-1149968    SRNL    Sathya              A4535   Correction          58  0:23:47
  JCID-1149968    SRNL    Pani Paul Prakash   A3100   Lapping          60     0:3:50
  </code></pre>