我正在尝试按名称对结果进行分组。
以下代码重现:
name | time_ |
-----------------------------------
stackoverflow 3:00
google 5:35
stackoverflow 1:00
SELECT agenc.name, (SELECT CAST(servic.end_hour as time) - CAST(servic.begin_hour as time)) AS time_, jobs.name,
FROM services AS servic
JOIN services_jobs AS jobs ON jobs.id = servic.job_id
JOIN agency AS agenc ON agenc.id = jobs.agency_id
WHERE
EXTRACT(MONTH FROM servic.service_date) = 9 AND
EXTRACT(DAY FROM servic.service_date) = 16
我希望它以这种方式出现:
name | time_ |
-----------------------------------
stackoverflow 4:00
google 5:35
可能吗?如果是这样,怎么做?
我想过分组,但我没有得到任何结果。