B
B
BadassRolf2017-05-18 17:57:57
MySQL
BadassRolf, 2017-05-18 17:57:57

How to count the total number of people from one date?

I have a database.
24b5ec0314ac488d9fb138bbff5c4f8b.png
I need to query the total number of people (num_psng) per month (date_flying)
For example, for May it turns out 75.
How can I do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Boris Korobkov, 2017-05-18
@BadassRolf

If by day, then

SELECT date_fluing, SUM(num_psng) FROM ... GROUP BY date_fluing

If by months, then
SELECT DATE_FORMAT(date_fluing, '%Y-%m'), SUM(num_psng) FROM ... GROUP BY DATE_FORMAT(date_fluing, '%Y-%m')

If only for one month (for example, May), then
SELECT SUM(num_psng) FROM ... WHERE DATE_FORMAT(date_fluing, '%Y-%m') = '2017-05'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question