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, 07:48

Breck%20Carter's gravatar image

Breck Carter
31.6k5106971019
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, 11:17

Volker%20Barth's gravatar image

Volker Barth
37.5k343512777
accept rate: 34%

converted 17 May, 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, 07:48

question was seen: 118 times

last updated: 17 May, 06:59