SELECT 
	tblPosts.idPost,
	tblPosts.postTitle, 
	tblPosts.postCode, 
	tblPostsStatus.scsTitle, 
	concat(code, '<br>', pTitle) AS pTitle, (CASE WHEN postResult = 1 THEN 'yes' ELSE 'no' END) AS postResult , 
	concat(date_format(postStartedDate, '%d.%m.%Y'), '<br>', date_format(postStartedDate, '%H:%i')) AS dateStart, 
	date_format(tblPosts.updated_at, '%d.%m.%Y %H:%i') AS dtUpdated, tblPerson.mobile, tblPerson.mail, tblPerson.isoLang, tblPostsReason.surname, 
	concat(coalesce(clientFName, ''), ' ', coalesce(clientName, '')) AS client, 
	concat(coalesce(concat(tblGender.gender, ' '), ''), coalesce(eFName, ''), ' ', coalesce(eName, '')) AS pers, 
	(CASE WHEN tblPosts.idCollab is NULLTHEN '' ELSE concat(coalesce(tblCol.cFName, ''), ' ', coalesce(tblCol.cName, '')) END) AS starter, 
	concat("<img src='img/status_", tblPosts.status, ".png' height='12px' border='1' />") AS displaystat,
	concat("<a href='index.php?arg=posts&id=", tblPosts.idPost, "&idAccess=", coalesce(tblAccess.idAccess, ''), "' title='Prepare Interface'><img src='../DG/styles/flat/images/edit.gif' style='height:14px; width:32px;' border='0'></a>") AS elink, 
	concat("<a href='email.php?frame=1&idPost=", tblPosts.idPost, "&source=PERS&idSrc=", tblPerson.idPerson, "&lang=", tblPerson.isoLang, "&from=", ";;SENDER", "&to=", tblPerson.persMail, "&idTperslate=CLI_diff_joindre_can,PERS_demande_contact,PERS_demande_CV&title=", replace(replace(replace(coalesce(pTitle, ''), "'", ";;APO"), "(", ";;PLT"), ")", ";;PGT"), "' title='", concat(coalesce(persName, ''), ' ', coalesce(persFname, '')), "' class='fancybox fancybox.iframe'><img src='img/email.png' height='12px' border='1' title='Messages' ></a>") AS mailink, 
	concat("<a href='post_email.php?frame=1&op=resend&idPosts=", tblPosts.idPost, "&idPerson=", tblPerson.idPerson, "&lang=", tblPerson.isoLang, "&idAccess=", coalesce(tblAccess.idAccess, ''), "&title=", replace(replace(replace(coalesce(pTitle, ''), "'", ";;APO"), "(", ";;PLT"), ")", ";;PGT"), "' title='", concat(coalesce(perName, ''), ' ', coalesce(perFName, '')), "' class='fancybox fancybox.iframe'><img src='img/emailNew.png' height='12px' border=1 title='New Posts' ></a>") AS newlink, 
	concat("<a href='comment.php?idPosts=", tblPosts.idPost, "&idPostsElem=-1&idClient=", tblPosts.idClient, "&frame=1&title=", replace(replace(replace(pTitle, "'", ";;APO"), "(", ";;PLT"), ")", ";;PGT"), "' title='", concat(coalesce(persName, ''), ' ', coalesce(persFName, '')), "' class='fancyboxstepreload fancybox.iframe'><div id='divBadgeComm", tblPosts.idPost, "' class='divBadge'>", (select count(*) from tblComment where idPosts=tblPosts.idPost and idElem is NULLand visibleClient=1), "</div><img src='img/comment.png' height='12px' border='1' title='Comments' /></a>") AS comments, 
	concat("<a href='docs.php?frame=1&idPosts=", tblPosts.idPost, "&title=", replace(replace(replace(pTitle, "'", ";;APO"), "(", ";;PLT"), ")", ";;PGT"), "' title='", concat(coalesce(persName, ''), ' ', coalesce(persFname, '')), "' class='fancyboxstep fancybox.iframe'><div id='divBadgeDocument", tblPosts.idPost, "' class='divBadge'>", (select count(*) from tblDocs where idPosts=tblPosts.idPost and docFileName <> '' and status=1), "</div><img src='img/dir.png' height='12px' border='1' title='Docs' /></a>") AS documents, 
FROM tblPosts
-- lots of LEFT JOIN
WHERE 1;

Maybe he didn't know how to do it in PHP ?

By Not a real programmer, 2018-07-10 11:03:17