-1

Would anyone be able to help me with creating a procedure that reports the total amount paid in a specific month and specific year? Or how I would even go about creating this?

Thank you for any and all help.

lurker
  • 56,987
  • 9
  • 69
  • 103

1 Answers1

1

I'm guessing you have a table that includes both a date column as well as an amount paid column. If that is the case, and you just want to sum the amount paid you can just use the SUM() function.

Try this:

SELECT SUM(totalAmountPaid) as totalForMonth
FROM tableName
WHERE MONTH(dateColumn) = monthYouWant AND YEAR(dateColumn) = yearYouWant

Here are date and time functions that may be useful.

AdamMc331
  • 16,492
  • 10
  • 71
  • 133