I have first a selection of
trip_id (for a train or a bus e.g.) in a (sub-)Table A
trip_id 350 351 360
and want to use a self-written function which takes the used
trip_id and gives back the a TABLE with
trip_id, used roads (in form of a
road_id) and the sequence
seq of stops for this trip (here for example trip no. 350):
SELECT * FROM getroutepertrip(350) ----- trip_id road_id seq 350 a1 1 350 g4 2 350 a2 3 . . . . . . . . .
The desired oucome of the whole problem should be like this above but for all the trips from the CTE subselect. Unfortunately, my function only can take a single
trip_id. My first and only attempt is of course wrong since a subquery can't contain multiple columns
WITH A AS (SELECT DISTINCT trip_id FROM stop_times) SELECT trip_id, (SELECT * FROM getroutepertrip(trip_id)) FROM A GROUP BY trip_id ORDER by trip_id
Hopefully somebody can help me here, it feels like I'm mentally in a deadlock...