If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
I want to make a simple question.
I want to query the count of the records at a table for a month (mm/yyyy), how i have to "format" the date for this in access?
Thanks
dimis
I had this answer from pootle flump in forum of access
Hi
You can either use a range in your where clause (WHERE MyDate BETWEEN 1st day of month and Last day of month) or you can use some functions (probably a little slower - WHERE Year(MyDate) = TheYearIWantToCheck AND Month(MyDate) = TheMonthIWantToCheck)
HTH
__________________
Environment: A02\03 SQL Server 2K DAO 3.6 ADO 2.7 VB6 SP5
Reply With Quote
Note that the range solution (WHERE MyDate BETWEEN '2005-12-01' AND '2005-12-31') is typically much more performant (and more portable too ) than the use of scalar functions (WHERE year(MyDate)=2005 AND month(MyDate)=12)
__________________
--_Peter Vanroose,
__IBM Certified Database Administrator, DB2 9 for z/OS
__IBM Certified Application Developer
__ABIS Training and Consulting
__http://www.abis.be/
dont use short date format for date comparison, coz every single second affects the result. '2005-01-01' means '2005-01-01 00:00:00.000', no more no less, even just 1 second. so i used to use function like year, month, day, datediff.
My problem was that I had to find the records from a table for the current month (in Ms access with asp) so I had to find dynamicaly the current month and then find the correct sql statement.
dimis