I am assuming this is a screenshot from the clinical module - patient lists.
I am also assuming that you started from “default” implementation rather than starting from absolute base.
You need to check the query that is executed.
This is driven by configuration - by search extension’s search handler config. Check here (you need to find corresponding extension.json in your implementation)
Once you have identified the “searchHandler”, go to openmrs => advanced settings: and search for the key, and modify/use appropriate SQL.
Refer WIKI please. Always a good starting place: Check Configure Patient Lists/Queues