Why query to extract expenditure based on creation_date takes too long?
I need an SQL query to extract expenditures of a certain type, that were not reversed and that have the creation_date into a given interval.
I created the below query, that works fine without the last condition (marked in bold, at the end of query). But I need to restrict based on the expenditure creation_date....any idea how this can be achieved in an efficient way?
SELECT ROUND((pex.RAW_COST_RATE * pex.quantity),2) daily_allowance_amt
, pex.incurred_by_person_id person_id