SQL Server Performance

Report expert help needed

Discussion in 'SQL Server Reporting Services' started by Akthar, Sep 15, 2006.

  1. Akthar New Member

    Hi guys,

    i need to generate the 3 columns the below report

    salesperson sales for current mth cummulated sales for curent and past month

    can someone help
    Thanks

    AKTHAR
  2. Adriaan New Member

    SELECT sp.SalesPerson,
    (SELECT SUM(s.Sales) FROM sales s WHERE s.SalesPerson = sp.SalesPerson AND s.Date BETWEEN '2006-08-01' AND '2006-08-31')
    PreviousMonthSales,
    (SELECT SUM(s.Sales) FROM sales s WHERE s.SalesPerson = sp.SalesPerson AND s.Date BETWEEN '2006-09-01' AND '2006-09-30')
    CurrentMonthSales
    FROM SalesPerson sp

Share This Page