fix sort sql