Forum Replies Created

Viewing post 1 (of 1 total)

  • RE: Simple SQL challenge - who can solve

    This Query will Return current and Previous 12 month Start Date..

    ==========================================

    DECLARE @month int=0

    DECLARE @table TABLE (LastYearDate DATETIME)

    WHILE @month<12

    BEGIN

    INSERT @table

    ( LastYearDate )

    SELECT DATEADD(MONTH,DATEDIFF(MONTH,0,GETDATE())-@month,0)

    SET...

Viewing post 1 (of 1 total)