Database Reference
In-Depth Information
8. Now,querythe tracks tabletogetareportofthetotaldistancerun(inkm)
bytherunnerforeachmonth.Forthispurpose,usethe ST_Length function,
as shown in the following query:
postgis_cookbook=# SELECT
EXTRACT(year FROM run_date) AS
run_year,
EXTRACT(MONTH FROM run_date) as
run_month,
SUM(ST_Length(geography(the_geom)))/
1000 AS distanceFROM chp03.tracks
GROUP BY run_year, run_month;
run_year | run_month |
distance
------------+-------------+------------------
2010 | 5 |
67.9277530981487
Search WWH ::




Custom Search