Link to home
Start Free TrialLog 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
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Murray Brown

ASKER

Thanks very much