modify query to add date