changed sql queries to avoid date comparisons