Filter not working with UNION ALL queries

i have created a Query report which consist of UNION of two different queries. after applying the filter %(filter)s to both the queries. the filter is only working on query 1 of union.
can somebody tell me whether filter can be worked with union all queries too?

Hi @chanchalkolhe,

When using UNION ALL in SQL queries, the filter conditions are typically applied to each individual SELECT statement within the UNION ALL. If the filter is only affecting one part of the UNION ALL, it could be due to how the queries are structured or limitations in the framework.

I don’t think I will be working on query reports. but it will work in the Server Script report.

https://github.com/search?q=repo%3Afrappe%2Ferpnext%20UNION&type=code

Thank You!

1 Like