fixed sql syntax and make sure we load only dates