text: SELECT t1.*, BO_ACCEPTED_LINKS.OBJECTGUID AS LINK FROM RI2 AS t1
  LEFT OUTER JOIN BO_ACCEPTED_LINKS
  ON t1.GUID = BO_ACCEPTED_LINKS.OBJECTGUID
     AND BO_ACCEPTED_LINKS.NUMLEVEL = 1 
  LEFT OUTER JOIN BO_LINKS
  ON BO_ACCEPTED_LINKS.fid = BO_LINKS.id
  LEFT OUTER JOIN BO_TYPELINKS
  ON BO_LINKS.id_type_link = BO_TYPELINKS.id 
     AND ((BO_TYPELINKS.SECOND_CLASS_NAME = 'LjVyls2VeoAtmHIT7WjyLb' AND BO_ACCEPTED_LINKS.ID % 2 = 0) 
       OR (BO_TYPELINKS.FIRST_CLASS_NAME = 'LjVyls2VeoAtmHIT7WjyLb' AND BO_ACCEPTED_LINKS.ID % 2 = 1))
  
  
  