Results 1 to 3 of 3

Thread: Help please

  1. #1
    Join Date
    Jun 2012
    Posts
    85

    Unanswered: Help please

    Here is My SQL, I am newer to databases in SQL. I am wanting to create a running sum but cant get it to work. My query is set up as Name, Date, Return, ID. I want to have the Return to have a running sum. please help



    SELECT [Monthly Performance Dates].[Fund Name], [Monthly Performance Dates].Year, [Monthly Performance Dates].Return, (SELECT Sum([Monthly Performance Dates].[Return]) AS Total FROM [Monthly Performance Dates] WHERE [Monthly Performance Dates].[ID] <= T1.[ID]) AS Total FROM [Monthly Performance Dates] AS T1) AS Growth, [Monthly Performance Dates].ID
    FROM [Monthly Performance Dates] INNER JOIN [Monthly Performance] ON [Monthly Performance Dates].ID = [Monthly Performance].ID
    GROUP BY [Monthly Performance Dates].[Fund Name], [Monthly Performance Dates].Year, [Monthly Performance Dates].Return, [Monthly Performance Dates].ID;

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    are you absolutely sure you're running mysql?

    because all those microsoftish square brackets will cause syntax errors
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jun 2012
    Posts
    85
    Thanks, i got it to work!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •