Why query to extract expenditure based on creation_date takes too long?
Summary:
SQL query
Content (required):
Hi,
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
, pex.expenditure_item_date
, pex.creation_date
, pex.expenditure_item_id