• Sean Lange (5/5/2015)


    minimay (5/5/2015)


    nevermind i figured it out

    Declare @Julycount int

    Set @Julycount= (Select Count(*) From orders Where MONTH(OrderDate) = 7)

    print 'The total orders for july is ' + Cast(@JulyCount as varchar)

    That will get you the count of orders in July for ALL years. Once you have orders in more than 1 year I don't think this will do what you want.

    You could add logic to the where clause for a specific year, if you wanted.



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]