Fixed syntax for previous queries between and dates