Select originalpostid,a.userpostid,maingroupname,nooffollowers,avgrating,userpostcommenttitle,userpostcomments,userpostimageforarticle,userpostdate,userpostbycompanyid,userposttype, isShared,originalpostid,userpostsuspended,userpostDontShow, userpostlikes,userpostdislikes,userpostlikenames,userpostdislikesnames, userpostsharecount, userpostthanks,userpostthankscount,userpostthanksnames,replycount,repliedbynames, userpostzappi,userpostnamaste, userpostcatid, userpostcatshortname, userpostcatname,localityid,userpostediteddatetime,userpostlastcommentdatetime,userpostimageid,userpostimagepath, userpostimagebyuserid,userpostimagesuspended,userpostimageremoved,userpostimagedate,b.companyprofilepath,b.CompanyName,b.companyurl,d.userid as user_id,b.companyprofilecoverphotopath from `EGLocal_trnUserPosts` a inner join mstcompany b on a.userpostbycompanyid=b.CompanyID left join EGLocal_trnUserPostsImages c on a.userpostid=c.userpostid inner join trnusercompany d on b.CompanyID=d.companyid LEFT JOIN trncompanyprofile e on d.companyid = e.companyid LEFT JOIN mstmaingroup g on e.productmainCategoryid=g.maingroupid where b.CompanyID = :companyid group by a.userpostid order by a.userpostdate desc, a.userpostscore desc
CHENNAI, INDIA