【发布时间】:2012-10-19 23:57:24
【问题描述】:
我有一系列按日期分区并按以下格式命名的表:
public.schedule_20121018
有没有办法在上述20121018 模式中生成日期序列,以便我可以在SELECT 到information_schema.tables 之间进行for 循环?
现在我有
SELECT * FROM information_schema.tables
WHERE table_type = 'BASE TABLE'
AND table_schema = 'public'
AND table_name like 'schedule_%'
ORDER BY table_name;
但例如我需要最近 7 天的记录,以便日期序列应从 20121012 开始到 20121018。谢谢!
【问题讨论】: