Fix SQL clause for the needs of CUSO