a query to Find average value for each ranges?
===

here is my table

    gid | distance (km) | subdistance (km) | iri_avg
    1 | 13.952 | 0 | 0.34
    2 | 13.957 | 0.005 | 0.22
    3 | 13.962 | 0.010 | 0.33
    4 | 13.967 | 0.015 | 0.12
    5 | 13.972 | 0.020 | 0.35
    ...


I would like to find AVG of iri_avg for each ranges, for example..
each 5 metre (by default)
each 10 metre
each 100 metre
each 500 metre

What is the PostgreSQL query to solve this problem ?



