[api] Corrected SQL that deals with project access