Hello,
Finally I have found a way to get values inside fields without actually modifying the underlying database.
Here is a sample code that I am using.
SELECT
id,
permit_type_desc,
status_current,
expiresdate_new,
permit_number,
CASE
WHEN expiresdate_new < NOW() THEN 'Expired'
WHEN status_current = 'Active' AND expiresdate_new < NOW() + INTERVAL '21 days' THEN 'Expiring Soon'
ELSE status_current
END AS updated_status
FROM
permit_data_for_search ;
This query checks the date of a field and based on various conditions updates another field value. Theoriginal query is very big and complex I am just sharing a simplified version so that it is easy to understand.
Hope this will help someone.
Once again @gabriel thanks for your timely help.