Jump to content

Using SELECT SEC_TO_TIME on 2 fields


joesoaper

Recommended Posts

Follow on posting to my previous post... had to take a totally new approach hence the new posting. As always any help or advice on how to find a solution is greatly appreciated.

 

 

I am trying to sum the total number of hours worked from 2 different fields - overtime_hours and overtime_hours1. I can get the code to run when only getting the information from one field, but am failing to get the same success when attempting to get it from 2 fields.

 

Here is the working code for one field.

$count_total_hours_worked = $pdo->query("SELECT SEC_TO_TIME( SUM( TIME_TO_SEC( `overtime_hours` ) ) )FROM dbase WHERE staff='Joe'  AND MONTH(CURDATE())=MONTH(serv_date) AND YEAR(serv_date) = YEAR(CURDATE()) ")->fetchColumn();     
                      
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.