C
C
cucumber1232015-12-01 14:18:09
Stored procedures
cucumber123, 2015-12-01 14:18:09

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

1 answer(s)
A
Artem Kileev, 2015-12-01
@akileev

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 question

Ask a Question

731 491 924 answers to any question