A lateral derived table is a special type of derived table. You can use the LATERAL keyword to specify a derived table that can reference columns of preceding tables or derived tables defined in the same FROM clause. This way, a subquery in the lateral derived table can reference tables defined in the same FROM clause and access column values in these tables.
A lateral derived table differs from a normal derived table in that it can reference columns in tables that are previously defined in the same FROM clause.
Examples
SELECT *
FROM A, LATERAL (SELECT * FROM B WHERE B.col1 = A.col1) AS derived_table;
References
For more information about how to use a lateral derived table, see Lateral derived tables.