A
A
Alexander Sinitsyn2018-03-12 19:29:35
Android
Alexander Sinitsyn, 2018-03-12 19:29:35

How to make a selection from the database by summing the field values ​​by day?

The database has fields value (int) and created_at (date time in mills).
How to make a selection by date period with grouping by day and summing values ​​per day?
Is it possible to extract the date from the field or do I need to add a field containing only the date without the time?
Or is it better to add a table in which to enter ready-made amounts / dates when adding / changing the data of the first table?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2018-03-12
@a_u_sinitsin

select
  strftime('%d-%m-%Y', created_at) as creation_date,
  sum(value) as val
from some_table
group by creation_date;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question