Answer the question
In order to leave comments, you need to log in
Stored procedure and DATEDIFF function?
There is a table with fields FIO and DataZayavleniya, display people who applied more often than once every six months
Answer the question
In order to leave comments, you need to log in
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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question