是否有一种简洁的方法来编写一个查询来在40个相同的文件上运行相当于以下查询:
SELECT * FROM file1
where created > '2017-03-01-00.00.00.000000'
and regDate < 20170101
SELECT * FROM file2
where created > '2017-03-01-00.00.00.000000'
and regDate < 20170101
.
.
.
SELECT * FROM file40
where created > '2017-03-01-00.00.00.000000'
and regDate < 20170101
答案 0 :(得分:0)
最好的答案似乎是:
with combinedFile as (
SELECT * FROM file1
union all
SELECT * FROM file02
.
.
.
union all
SELECT * FROM file40 )
SELECT * FROM combinedFile
where created > '2017-03-01-00.00.00.000000'
and regDate < 20170101
感谢所有帮助我通过发表评论来达到这个答案的人!