Maria DB: how to execute a sum between times in SEC_TO_TIME argument?

Viewed 46

I'm actually in this situation (these are part of a unique query):

SELECT SEC_TO_TIME(_staffTime) AS _staffTimeTotal

I have another value expressed in seconds (from another table): _staffTimeBo

Both _staffTimeBo and _staffTime are so calculated:

SELECT SUM(tiStaffTimeBo) AS _staffTimeBo FROM table1

SELECT SUM(tiStaffTime) AS _staffTime FROM table2

What I need is get the sum in y/m/d hh:mmm:ss resulting by _staffTimeBo + _staffTime

I tried several solutions but no one gave me the right result

Example I tried this:

SELECT SEC_TO_TIME(SUM(_staffTimeBo) + SUM(_staffTime)) AS _staffTimeTotal

AND

SELECT tiStaffTimeBo AS _staffTimeBo FROM table1

SELECT tiStaffTime AS _staffTime FROM table2

I'm now simply trying this:

SELECT SEC_TO_TIME(_staffTimeBo + _staffTime ) AS _staffTimeTotal

AND

SELECT SUM(tiStaffTimeBo) AS _staffTimeBo FROM table1

SELECT SUM(tiStaffTime) AS _staffTime FROM table2

Anyway, also this "solution" doesn't work

Is there a way to sum this two times?

0 Answers
Related