Let One Row Represent A Group, Take Three
October 27, 2015 Ted Holt
Faithful reader Bill Cisne sent me an email with an SQL SELECT query. No comment, no explanation, just code. Bill had figured out how to use a lateral join to solve a problem and was kind enough to share his success with me. I have been aware of lateral joins for some time, but have not found a need for them in my work. Today I revisit a problem to illustrate one way that lateral joins can be useful. LATERAL is a type of for-each loop within a query. For each row that a SELECT statement (the “outer” query) returns, |