作用
cross join 交叉连接,生成连接表的笛卡尔集,不需要添加 on。
示例
leetcode197. 上升的温度
获取温度比昨天大的id。
| id | recordDate | Temperature |
|---|---|---|
| 1 | 2015-01-01 | 10 |
| 2 | 2015-01-02 | 25 |
| 3 | 2015-01-03 | 20 |
| 4 | 2015-01-04 | 30 |
# orcale
select a.id from Weather a
cross join Weather b
where a.Temperature > b.Temperature
and a.recordDate - 1 = b.recordDate;
文章介绍了如何使用OracleSQL的Crossjoin操作来查找温度比前一天高的记录。通过交叉连接Weather表并设置条件,可以找到温度升高的id及其对应日期。
918

被折叠的 条评论
为什么被折叠?



