Link to home
Create AccountLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Access equivalent of SQL query

Hi

What would the Access equivalent of the following SQL query be? The main problem is "DATEPART"

SELECT DATEPART(Year, [Transactions].[Transaction Date])  As Year, DATEPART(Month, [Transactions].[Transaction Date]) As Month, SUM([Transactions].[Amount]) As TotalAmount  
FROM Transactions
WHERE DATEPART(Year, [Transactions].[Transaction Date])  = DATEPART(Year,getdate())
AND DATEPART(Month, [Transactions].[Transaction Date])  = DATEPART(Month, getdate())
GROUP BY DATEPART(Year, [Transactions].[Transaction Date]), DATEPART(Month, [Transactions].[Transaction Date])
ORDER BY Year, Month
SOLUTION
Avatar of Rgonzo1971
Rgonzo1971

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
ASKER CERTIFIED SOLUTION
Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of Murray Brown

ASKER

Thanks very much