Simplified Sql query to not double date format for some resolutions