Using MySQL, I can do something like:
SELECT sum(capacity) FROM table_name GROUP BY HOUR(time) ;
My Output:
1240
987
1092
1205
but instead I just want 1 row, 1 col:
Expected Output:
1240, 987, 1092, 1205
You could use group concat on your result
SELECT group_concat(my_sum)
from (
select sum(capacity) my_sum
FROM table_name
GROUP BY HOUR(time)
ORDER BY Hour(time)
) t
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.