JOIN (SELECT … ) ue ON 1=1?

前端 未结 4 2048
野的像风
野的像风 2020-12-15 04:59

I am reading an SQL query in Redshift and can\'t understand the last part:

...
LEFT JOIN (SELECT MIN(modified) AS first_modified FROM user) ue
ON 1=1
         


        
4条回答
  •  無奈伤痛
    2020-12-15 05:30

    I believe its used to emulate cartesian join.

    From your query, the least modified value (It will be just 1 element) will be assigned to all the records of the left table.

    PS : Left join is not much useful here. Might as well just use inner join

提交回复
热议问题