Skip to content
Advertisement

Create a stored procedure to populate a table with one row-Yearly and Monthly Averages

I have created a stored procedure to populate a log table. I am having trouble with the syntax for columns H and I. Is there something wrong with my syntax as it relates to monthly and yearly averages? My problem seems to be with those lines of code.

Output ROW enter image description here Stored Procedure

Advertisement

Answer

Maybe you dont have any sales in the sales table from this month or year? If you are confident that you do, maybe just run

select distinct month(salesdate) from sales

and also run

Select month(now())

and just see if there was anything different in your data?

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement