D
D
d1zz742021-08-05 08:30:04
MySQL
d1zz74, 2021-08-05 08:30:04

How to output by columns in MySql?

SELECT date_format(FROM_UNIXTIME(sms.created_at), '%Y-%m'), count(*)
***
GROUP BY date_format(FROM_UNIXTIME(sms.created_at), '%Y-%m');

It outputs like this:
2021-01	3021
2021-02	11389
2021-03	11971
2021-04	24577
2021-05	16958
2021-06	21310
2021-07	21016
2021-08	5134

In principle, it is logical, but is it possible to do like this:
2021-01 | 2021-02
3021      |  11389

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question