【发布时间】:2021-12-23 00:59:12
【问题描述】:
我想通过使用 UNION 来整理一些查询的结果。但我只想执行一些查询...在下面的示例中,('Daily','Yearly') 部分将自动填写。
类似的东西:
(if 'Daily' in ('Daily','Yearly') then
my first query goes here...
end if)
UNION ALL
(if 'Monthly' in ('Daily','Yearly') then
my second query goes here...
end if)
UNION ALL
(if 'Yearly' in ('Daily','Yearly') then
my third query goes here...
end if)
在此示例中,第二个查询的结果不应出现在输出中。
附带说明:我已经有 3 个工作查询,我缺少的是如何动态执行它们并将它们放在一个输出中。
【问题讨论】:
标签: postgresql if-statement select