fix query on mysql