2

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

2
  • use group by for month Commented Nov 7, 2013 at 6:56
  • 1
    psql is the commandline client for Postgres. mysql is a different DBMS. Which one are you using? Commented Nov 7, 2013 at 7:01

2 Answers 2

3

In PostgreSQL try to use date_trunc

WHERE createddate >= date_trunc('month', CURRENT_DATE)
Sign up to request clarification or add additional context in comments.

Comments

0

Please try this , it will work on MS Sql server

select count(*) as counter 
from  ##TBL_TEMP
WHERE DATEPART(MONTH,createddate) > DATEPART(MONTH, GETDATE());

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.