JOIN(SELECT ...)ue ON 1 = 1? [英] JOIN (SELECT ... ) ue ON 1=1?

查看:1286
本文介绍了JOIN(SELECT ...)ue ON 1 = 1?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Redshift中读取SQL查询,但不了解最后一部分:

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

ON 1=1在这里是什么意思?

推荐答案

它只是在进行交叉连接,它选择了第一张表中的所有行和第二张表中的所有行,并显示为笛卡尔积,即具有所有可能.

It's simply doing a cross join, which selects all rows from the first table and all rows from the second table and shows as cartesian product, i.e. with all possibilities.

JOIN(向左,向内,向右等)语句通常需要'ON ...'条件.放入1 = 1就像说"1 = 1始终为真,什么也不要消除".

JOIN (LEFT, INNER, RIGHT, etc.) statements normally require an 'ON ..." condition. Putting in 1=1 is like saying "1=1 is always true, do don't eliminate anything".

这篇关于JOIN(SELECT ...)ue ON 1 = 1?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆