SELECT p.status,
COUNT(*) AS CC,
GROUP_CONCAT(p.Recipient SEPARATOR '; ') AS Recipients,
n.Msg_Title,
n.*
FROM `com_msg_ng` n
LEFT JOIN `com_msg_po` p ON p.GUIDNg = n.GUID
WHERE YEAR(n.CreateAt)=2025
      -- and (p.Recipient like '%plominska%' OR p.Recipient like '%andy%')
      -- AND n.GUID like 'Wnios.WorkFlow=%'
      -- and p.Recipient like '%basar%'
      -- and p.Recipient like '%andy%'
      -- and n.Msg_Title like '%wniosek%'
--  where p.Recipient like '%kadry.zoo@konkol.pl%'
--  where -- n.Msg_Mode in ('Mail_zapomnialem_hasla','Mail_aktywujacy')
-- and          n.Sender ='kadrysec@security.gd.pl'
   -- and msg_Body like '%urlop%'
   -- AND p.recipient LIKE '%ewbrzoza%'
  -- and n.Msg_Title like '%milewczyk%'
  -- and p.Recipient like '%cinek%'
   GROUP BY n.GUID
ORDER BY n.idn DESC
;