CREATE PROCEDURE ProcName
AS
SELECT
T.FIO, T.DataZayavleniya, C.ClaimCount
FROM
TableName T
LEFT JOIN (
SELECT
FIO, COUNT(*) AS ClaimCount
FROM
TempMssg
GROUP BY
FIO, DATEPART(YEAR, TimeOn), DATEPART(MONTH, TimeOn) / 6
) C ON C.FIO = T.FIO
WHERE
C.ClaimCount > 1