我已经解决了这个问题一段时间,希望你能帮助我。
我有一份关于 iReport 的报告,即使某些参数为空,我也希望填写该报告。
这就是我所拥有的
SELECT
evento."titulo" AS evento_titulo,
evento."data_inicio_realizacao" AS evento_data_inicio_realizacao,
evento."data_fim_realizacao" AS evento_data_fim_realizacao,
evento."id" AS evento_id
FROM
"public"."evento" evento
WHERE
evento."id" = $P{eventoid} OR
evento."data_inicio_realizacao" BETWEEN $P{data1} AND $P{data2}
我希望 WHERE 子句是可选的,即,如果我将这些参数保留为空(或在 id 的情况下为 0 值),我想获取所有值而不是空白报告。
可能吗?我发现有些人制作了 $P{WHERE_CLAUSE} 并将整个 where 子句作为其值传递,但它对我不起作用。