diff --git a/backend/routers/goals.py b/backend/routers/goals.py index 8ab0877..ed4df73 100644 --- a/backend/routers/goals.py +++ b/backend/routers/goals.py @@ -713,7 +713,7 @@ def _get_historical_value_for_goal_type(conn, profile_id: str, goal_type: str, t FROM {source_table} WHERE profile_id = %s AND {date_col} BETWEEN %s AND %s - ORDER BY ABS(EXTRACT(EPOCH FROM ({date_col} - %s::date))) + ORDER BY ABS({date_col} - %s::date) LIMIT 1 """, ( profile_id,