How to calculate totals - Joomla! Forum - community, help and support
i have table looks this:
so, shows when office had downtime , how long lasted. how calculate (add) total time "nyc" office only? so, want output 01:40 (combined 01:23 + 00:17).
my query looks this:
code: select all
office | start | end | total
------------------------------------------------------------
nyc | 2014-07-01 20:56:00 | 2014-07-01 22:19:00 | 01:23 |
ewi | 2014-07-17 17:35:00 | 2014-07-17 18:05:00 | 00:30 |
nyc | 2014-07-11 03:09:00 | 2014-07-11 03:26:00 | 00:17 |
------------------------------------------------------------
so, shows when office had downtime , how long lasted. how calculate (add) total time "nyc" office only? so, want output 01:40 (combined 01:23 + 00:17).
my query looks this:
code: select all
$query->select($db->quotename(array('id', 'office', 'start', 'end', 'total')));
$query->from($db->quotename('#__outage'));
excellent question!
here's query:
here's query:
code: select all
select office, sec_to_time(sum(time_to_sec(`total`))) `total_downtime_office` `your_table` group office;
Comments
Post a Comment