I have a table user_games with a date field created_at. So I’m trying to group records by given year and month and find the number of records. I use MySQL. So this is my query. It seems it’s working, but I am not sure that it is the correct way
SELECT concat(year(ug.created_at), '-' ,month(ug.created_at)), ug.user_id, count(*) FROM user_games ug GROUP BY concat(year(ug.start_date), '-' ,month(ug.start_date));
Is there better approche ?
- 1Bitbucket and Visual Studio
- 1How to dump and restore database in MongoDB
- 1How to compress and extract files/folders using the tar command on Ubuntu
- 5What is "marquee" tag and how I can use it in HTML?
- 1How To Create a New User and Grant Permissions in MySQL
- 1What is the difference between setTimeout and setInterval?
- 3What's the difference between using “let” and “var”?
- 1Abstract and Virtual Methods
- 1What is PATH, and when to use it in C++
- 1How to make my footer cover 100% height and width of the page from top?
- 0What is the difference between custom dimensions and metrics in Google Analytics