Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / November 2005

Tip: Looking for answers? Try searching our database.

Sort totals  by month

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Michael - 17 Nov 2005 14:43 GMT
I need to have a query that sorts by products received by months for a
report.

I have the following sql and this gives me a total of all the records in the
table by product and then by weight.  I want to add the field [del] which is
the date of delivery which is formatted as a short date in the table.

All the help files I have seen speak of using a separate month and year
field to sort by month. Is there a way to search within this query using the
existing data in the [del] field?

thank you
Michael

SELECT [Registro Entrate].Fornitore, [Registro Entrate].Prodotto,
Sum([Registro Entrate].PesolordoKG) AS SumOfPesolordoKG
FROM [Registro Entrate]
GROUP BY [Registro Entrate].Fornitore, [Registro Entrate].Prodotto
ORDER BY [Registro Entrate].Prodotto, Sum([Registro Entrate].PesolordoKG);

I tried a few ways and all sort by month, but give me a line for each
delivery instead of a total for each product for the month as in the above

I tried to use =Month([del]) as below but that returned no records.

SELECT [Registro Entrate].Fornitore, [Registro Entrate].Prodotto,
Sum([Registro Entrate].PesolordoKG) AS SumOfPesolordoKG, [Registro
Entrate].Del
FROM [Registro Entrate]
GROUP BY [Registro Entrate].Fornitore, [Registro Entrate].Prodotto,
[Registro Entrate].Del
HAVING ((([Registro Entrate].Del)=Month([del])))
ORDER BY [Registro Entrate].Prodotto, Sum([Registro Entrate].PesolordoKG);
Marshall Barton - 17 Nov 2005 16:08 GMT
Use Format(datefield, "yyyy") instead your datefield
everywhere in the query.
Signature

Marsh
MVP [MS Access]

>I need to have a query that sorts by products received by months for a
>report.
[quoted text clipped - 26 lines]
>HAVING ((([Registro Entrate].Del)=Month([del])))
>ORDER BY [Registro Entrate].Prodotto, Sum([Registro Entrate].PesolordoKG);
Michael - 17 Nov 2005 16:26 GMT
Thank you Marshall
Michael
> Use Format(datefield, "yyyy") instead your datefield
> everywhere in the query.
[quoted text clipped - 31 lines]
>>HAVING ((([Registro Entrate].Del)=Month([del])))
>>ORDER BY [Registro Entrate].Prodotto, Sum([Registro Entrate].PesolordoKG);
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.