[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Max per month

Posted on 2016-11-30
3
Medium Priority
?
69 Views
Last Modified: 2016-11-30
Experts, how would I be able to show a MAX for [Available WC]+[Available OD] AS AvailCumWCOD but for the month?  The field the keeps the date is [date].  

SELECT Import_FC_Archive.*, [Available WC]+[Available OD] AS AvailCumWCOD
FROM Import_FC_Archive
WHERE (((Import_FC_Archive.Date) Between DateSerial(Year(Date()),Month(Date())-3,1) And DateSerial(Year(Date()),Month(Date())+4,0)));


thank you
0
Comment
Question by:pdvsa
3 Comments
 
LVL 19

Expert Comment

by:John Tsioumpris
ID: 41907120
With out looking at a sample of your data i can give you only a generic query
SELECT Import_FC_Archive.*
	,max([Available WC] + [Available OD] AS AvailCumWCOD)
FROM Import_FC_Archive
WHERE (
		(
			(Import_FC_Archive.DATE) BETWEEN DateSerial(Year(DATE ()), Month(DATE ()) - 3, 1)
				AND DateSerial(Year(DATE ()), Month(DATE ()) + 4, 0)
			)
		)
GROUP BY [All the fields you want to group by]

Open in new window

0
 
LVL 52

Accepted Solution

by:
Gustav Brock earned 2000 total points
ID: 41907136
What do you think of with "but for the month"?

If for any month, then:
SELECT 
    Format(Import_FC_Archive.Date, "yyyy-mm") AS YearMonth,
    Max([Available WC]+[Available OD]) AS AvailCumWCOD
FROM 
    Import_FC_Archive
GROUP BY 
    Format(Import_FC_Archive.Date, "yyyy-mm")

Open in new window

/gustav
0
 

Author Closing Comment

by:pdvsa
ID: 41907596
thank you.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question