SQL examples

Inspect the actual SQL, returned values, and PostgreSQL column types from the comparison fixtures.

LATERAL join

The subquery computes a total for each customer.

SELECT c.cust, t.total FROM (SELECT DISTINCT cust FROM inv) c JOIN LATERAL (SELECT sum(amount) AS total FROM inv i WHERE i.cust=c.cust) t ON true ORDER BY 1

Recorded results

SELECT 2
#custtexttotalnumeric
1acme80.25
2beta0.00
Current regression corpus · array and JSON group · case 26

These examples use saved replay results. Run your own query or see the full comparison.