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 shops WHERE region = "Canada" ORDER BY name
If my parameter is true, I would like to add and isactive = 'Y'
just before ORDER BY
.
Anybody knows how I can achieve this?
You can add additional parameter for setting additional clause value. After that you can use
$P!{}
syntax in query.The sample:
Try this
You can do that direct in SQL