Java – get the month name of a specific date range
•
Java
I have a date range '2015 / 01 / 01' to '2015 / 12 / 31'
From this date range, I want to display the unique device of that month_ IDS month name and № For example, my date and devie_ The database of ID is two columns
date device_id 2015-01-01 1 2015-01-20 1 2015-03-01 1 2015-03-01 3 2015-04-01 2 2015-06-01 3 2015-08-01 4 2015-09-01 1
Expected results
Month device_count January 1 March 2 April 1 June 1 August 1 September 1
How to bring the month name? I'm using java classes to retrieve data
Here is the result I need, a clear image
Solution
select month(date),count(distinct device_id) from table_name group by month(date);
select month(date),count(distinct device_id) from table_name group by month(date);
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码