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

查看:33
本文介绍了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 (LEFT, INNER, RIGHT, etc.) 语句通常需要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天全站免登陆