add remove split language show hidden hide
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
setseed
SELECT 1
CREATE TABLE
CREATE TABLE
CREATE TABLE
INSERT 0 2000
INSERT 0 40000
INSERT 0 20000
ERROR:  invalid reference to FROM-clause entry for table "r"
LINE 8:     where rts.route_id = r.route_id
                                 ^
DETAIL:  There is an entry for table "r", but it cannot be referenced from this part of the query.
HINT:  To reference that table, you must mark this subquery with LATERAL.