'Pgrouting insert od columns into pgr_dijkstra query

I try to calculate travels between a pair list of 2 layers : origin and destination. I create a table of combinaison between this two layers with vertices id in vertices_o for origin and vertices_d for destination. I call the columns into this query.

The combination table

![enter image description here

The query

CREATE TABLE travel.results AS
(SELECT seq, path_seq, node,  edge, di.cost, agg_cost, the_geom FROM pgr_dijkstra('
            SELECT gid as id,
             source::integer,
             target::integer,
             length_m::double precision as cost
            FROM travel.ways', 
            vertices_o, vertices_d, true) as di
JOIN travel.ways ways_vertices_pgr
ON di.edge = ways_vertices_pgr.gid);

He didn't recognize the columns vertices_o and vertices_d.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source