Reputation: 4941
Im using the followig query to get count per day ,
select count(*) as counter
from art.pub
WHERE createddate > CURRENT_DATE;
I want to adjust it and get it count per current month ,
any tips to adjust my query
Upvotes: 2
Views: 1874
Reputation: 1106
Please try this , it will work on MS Sql server
select count(*) as counter
from ##TBL_TEMP
WHERE DATEPART(MONTH,createddate) > DATEPART(MONTH, GETDATE());
Upvotes: 0
Reputation: 24144
In PostgreSQL try to use date_trunc
WHERE createddate >= date_trunc('month', CURRENT_DATE)
Upvotes: 3