Click here to Skip to main content
15,897,226 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello, I was creating a frontend and backend form my coffee shop i have recently opened. I have problem in creating query for daily,monthly and yearly sales report.
Posted

1 solution

Daily report
SQL
SELECT Field1, Field2, ..., FieldN
FROM TableName
WHERE DateField = #MM/dd/yyyy#


Weekly report:
SQL
SELECT Field1, Field2, ..., FieldN
FROM TableName
WHERE DateField BETWEEN #MM/dd/yyyy# AND DateAdd('ww', -1, #MM/dd/yyyy#)


Monthly report:
SQL
SELECT Field1, Field2, ..., FieldN
FROM TableName
WHERE DateField BETWEEN #MM/dd/yyyy# AND DateAdd('m', -1, #MM/dd/yyyy#)


Yearly report:
SQL
SELECT Field1, Field2, ..., FieldN
FROM TableName
WHERE DateField BETWEEN #MM/dd/yyyy# AND DateAdd('yyyy', -1, #MM/dd/yyyy#)


For further information, please see: http://www.techonthenet.com/access/functions/date/dateadd.php[^]
 
Share this answer
 
Comments
[no name] 14-Feb-14 2:18am    
5+..:)
Maciej Los 14-Feb-14 2:19am    
Thank you ;)
Anish Reddy 14-Feb-14 2:41am    
thank u but i really dont know much about coding. so if dont mind can u explain me in detail.
thank u
Maciej Los 14-Feb-14 2:45am    
What programming language? You need to be more specific, if you want to get detailed answer.
Please, post another question and close this thread with accepting my answer as a solution(green button).
Anish Reddy 14-Feb-14 2:51am    
vb.net

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900