sequelize group by day

use function date_trunc

 

 

sql:

 

SELECT date_trunc('day',"createdAt") FROM "IAPRecords" WHERE "IAPRecords"."UserId" = 1 GROUP BY date_trunc('day',"createdAt");

 

 

https://www.postgresql.org/docs/current/functions-datetime.html#FUNCTIONS-DATETIME-TRUNC 

 

 

 

原文地址:https://www.cnblogs.com/ybleeho/p/9930877.html