The FROM clause

SELECT table1.whatever,
       table2.etcetera
  FROM table1, LATERAL ( table-expression ) AS table2 

works as if it was coded as an INNER JOIN with special LATERAL properties... rows in table1 that don't match rows in table2 are excluded from the result set.

LATERAL is very cool (and fast), but so is LEFT OUTER JOIN.

asked 15 May '21, 07:48

Breck%20Carter's gravatar image

Breck Carter
32.5k5407241050
accept rate: 20%


I'd use OUTER APPLY here, and CROSS APPLY for inner joins, see here... - and particularly Glenn's older blog article - those were the days...

permanent link

answered 15 May '21, 11:17

Volker%20Barth's gravatar image

Volker Barth
39.7k357545814
accept rate: 34%

converted 17 May '21, 11:19

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×5

question asked: 15 May '21, 07:48

question was seen: 674 times

last updated: 17 May '21, 06:59