greater than 30 days

  • How do I use datediff to make this line say greater than 30 days?

    agenttime >= '2011-09-05 12:12:01.000'

  • So you want everthing before september 5th or evertything after that?

  • Is this what you are looking for?

    DECLARE @agenttime TABLE

    (agenttime DATETIME)

    INSERT INTO @agenttime SELECT ('2011-09-05 12:12:01.000')

    INSERT INTO @agenttime SELECT ('2011-09-06 12:12:01.000')

    INSERT INTO @agenttime SELECT ('2011-09-04 12:12:01.000')

    SELECT *

    FROM @agenttime

    WHERE DATEDIFF(DD, agenttime, GETDATE()) >= 30

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply