JasperReports: How to add a WHERE statement in SQL query depending on a Boolean parameter?

前端 未结 3 960
刺人心
刺人心 2021-01-24 04:34

How can I add a sub where statement in SQL if my Boolean parameter is true in JasperReports?
For example, I have my SQL as below:

SELECT * FROM shop         


        
3条回答
  •  独厮守ぢ
    2021-01-24 04:50

    Try this

    select * from shops where region = "Canada"
    AND isActive = CASE WHEN @var = 'True' then 'Y' ELSE isActive END
    order by name
    

提交回复
热议问题