select IF( length(i.ChangedDate)=0, concat(substring(i.AddedDate,1,10),' added'),
concat(substring(i.ChangedDate,1,10),' edited')) as Date_Added__or__Changed,
substring(i.AddedDate,1,10) as Date_Added, i.*
from
nccs_links.LINKS i
LEFT JOIN nccs_links.Items_topics_xref x ON i.id = x.ItemID and i.isDeleted = 0 and x.isDeleted = 0
LEFT JOIN communityneeds.taggeditem ti ON ti.knowledgebaseId = i.id
LEFT JOIN communityneeds.tag t ON t.id = ti.tagId
WHERE 1 and publish='Y' and i.isDeleted = 0 AND (i.GroupID < 1 || i.GroupID IS NULL) AND (i.ProjectID < 1 || i.ProjectID IS NULL) AND (i.GroupEdit LIKE '' or i.GroupEdit IS NULL) and i.platform = 'dc2'
GROUP BY i.id
ORDER BY i.Name, i.name
LIMIT 100;