How do I write something similar to this to use in database?
Trying to pull the previous month of data and automate it.
DateTimeFormat(DateTimeAdd(DateTimeToday(),-1,"month"),'%Y-%m') = DateTimeFormat([EventDate],'%Y-%m')
kind of depends upon the back end of the SQL but something like:
TRUNC(DATEADD(MONTH, -1, GETDATE()), "YY-DD") = TRUNC("EventDate", "YY-DD")
User | Count |
---|---|
52 | |
27 | |
25 | |
24 | |
21 |