在某次汇总时需要得到0-100岁的某个数据集,作为left join语句的左侧,简单的做法是
select '0岁' age from dual union all select '1岁' age from dual union all ...
得到所有想要的数据集 用connect by子句能简化这一步骤
select level||'岁' r from dual connect by level
select '0岁' age from dual union all select '1岁' age from dual union all ...
得到所有想要的数据集 用connect by子句能简化这一步骤
select level||'岁' r from dual connect by level
本文介绍了一种利用SQL中的Connect By子句快速生成0到100岁年龄序列的方法,这种方法相较于传统的Union All方式更为简便高效。
5310

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



