SQL Moving Average – SQL Server Training, Subquery, Datediff, Dateadd



Moving Average in SQL can be inefficient leading people to say that you should use a cursor. This video shows a SQL Server method that is set-based and is faster than the cursor method.

READ THE ORIGINAL ARTICLE WITH SQL SCRIPTS HERE

YOUTUBE NEWS UPDATES

VISIT SqlTrainingOnline.com FOR TONS MORE VIDEO NEWS & TIPS

SUBSCRIBE FOR OTHER SQL TIPS AND NEWS!

SUBSCRIBE TO OUR EMAIL LIST!

LET’S CONNECT!
Google+:
Facebook:
Twitter:
Linkedin:
SQLTrainingOnline:

Nguồn: https://noviway.com/

Xem thêm bài viết: https://noviway.com/category/cong-nghe

1 thought on “SQL Moving Average – SQL Server Training, Subquery, Datediff, Dateadd

  1. Dear Joey,

    I just saw you video on youtube about calculating moving average in SQL server.

    I wish you could help me on solving the problem that i am current facing on calculating Moving Average.

    I have data something like this.

    Store Name Quarter Week Sales Moving Average
    Store 1        FY15 Q1 W01  100         100
    Store 1        FY15 Q1 W02    80          90
    Store 1        FY15 Q1 W03   125        101
    Store 1        FY15 Q1 W04     20          75
    Store 1        FY15 Q1 W05    104          83
    Store 2        FY15 Q1 W01      80              80
    Store 2        FY15 Q1 W02      34          34
    Store 2        FY15 Q1 W03      16          43
    Store 2        FY15 Q1 W04      12          20
    Store 2        FY15 Q1 W05    111          46 

    Please advice how can I achieve this moving average in SQL

Leave a Comment