SELECT S.id AS idsector,SL.name AS sector,S.description AS awe,E.id AS id,E.reas AS sello,E.latitude AS latitude,E.longitude AS longitude,E.address AS address,EL.idlanguage AS idi,EL.description AS description,C.id AS idcontent,C.url AS url,CL.description AS document,CL.title AS title,U.username AS user,EL.name AS name,E.url AS e_url,E.telephone AS phone,E.email AS email,E.facebook AS facebook,E.twitter AS twitter,E.telegram AS telegram,LENGTH(CONCAT(E.facebook,E.twitter,E.telegram)) AS l_rrss,A.latitude AS Alatitude,A.longitude AS Alongitude,A.longitude AS Aaddress FROM enterprise AS E JOIN "user" AS U ON U.identerprise=E.id AND U.enabled=true JOIN enterprise_language AS EL ON EL.identerprise=E.id AND EL.idlanguage IN(1) AND E.id = 165 LEFT JOIN enterprise_sector AS ES ON E.id=ES.identerprise LEFT JOIN content AS C ON C.identerprise IN (E.id,NULL) AND C.idcontenttype =4 LEFT JOIN content_language AS CL ON C.id = CL.idcontent AND CL.idlanguage IN (1, NULL) LEFT JOIN sector AS S ON S.id=ES.idsector JOIN sector_language AS SL ON SL.idsector=S.id AND SL.idlanguage IN(1) LEFT JOIN enterprise_address AS A ON A.identerprise IN (E.id,NULL) WHERE 1=1 ORDER BY E.name ASC