Oct 28, 2002 #1 rbeatty MIS Joined Oct 28, 2002 Messages 8 Location US How do I go about a query that recongnizes when a month passes and then takes the total of a numerical field in my database. Thanks Roger
How do I go about a query that recongnizes when a month passes and then takes the total of a numerical field in my database. Thanks Roger
Oct 28, 2002 #2 r937 Technical User Joined Jun 30, 2002 Messages 8,847 Location CA Code: select sum(amount) from yourtable where day(date()) = 01 and month(date()) - month(datecol) = 1 produces output only on the first of every month selects all rows where the datecol is previous month caution: does not work in january!! you should be able to figure that out using the year() function rudy Upvote 0 Downvote
Code: select sum(amount) from yourtable where day(date()) = 01 and month(date()) - month(datecol) = 1 produces output only on the first of every month selects all rows where the datecol is previous month caution: does not work in january!! you should be able to figure that out using the year() function rudy
Oct 28, 2002 Thread starter #3 rbeatty MIS Joined Oct 28, 2002 Messages 8 Location US Thanks alot Rudy, that helped out. Roger Upvote 0 Downvote