Fixed sql typo. History tested and works