Group by month in SQLite

前端 未结 6 720
礼貌的吻别
礼貌的吻别 2020-12-16 14:17

I have an SQLite database which contains transactions, each of them having a price and a transDate.

I want to retrieve the sum of the transactions

6条回答
  •  青春惊慌失措
    2020-12-16 14:23

    This another form:

    SELECT SUM(price) AS price,
    STRFTIME('%Y-%m-01', created_at) as created_at
    FROM records
    GROUP BY STRFTIME('%Y-%m-01', created_at);
    

提交回复
热议问题