需求是这样的:数据源在多张数据集中,表名大约是dat_yyyymm,即201111、201112、201201、201202……
我需要做一项功能,在用户设置了开始日期、结束日期,比如201111至201202,然后合并这些表中指定条件的指定字段,那么我可以:
select &retain.
from (
select &retain. from dat_201111 where &condition.
union all
select &retain. from dat_201112 where &condition.
union all
select &retain. from dat_201201 where &condition.
union all
select &retain. from dat_201202 where &condition.
)
group by ...
如果用宏循环该如何做到生成连续的含有yyyymm月份的文本(且中间不能出现分号啊)呢?