Lukas Eder shows off one of my favorite operators:
The SQL:1999 standard specifies the
<lateral derived table>
, which is SQL’s way of allowing for a derived table (a subquery in theFROM
clause) to access all the lexically preceding objects in theFROM
clause. It’s a bit weird in terms of syntax, I personally think that Microsoft SQL Server has a much nicer solution for this concept viaAPPLY
. Oracle supports both syntaxes (standard and T-SQL’s). Db2, Firebird, MySQL, PostgreSQL only haveLATERAL
.
Click through to see how the operator works.
Comments closed