lundi 21 décembre 2015

SQL Datetime query

Given a database, having table named as users with id and created_at field. Id is smallint type and created_at is datetime type.Want to know the people registered for every month.

The database am using is SQLite.

Wrote this simple query which supposed to be working but it gives an error. Could you please help me out.

select count(id) as Orders, DATEPART(mm,created_at) AS Ordermonth
from users
Group by DATEPART(mm,created_at);

Aucun commentaire:

Enregistrer un commentaire