I have got a MySQL Table with 4 columns: completedtasks, duration, date and educationDepartment. My first aim was to show my entries by the name of the weekday for the specific day I have. I accomplished that with following query:
SELECT DAYNAME(date) AS DAY,
completedtasks,
duration,
educationDepartment
FROM programm_completedtask;
Now I want to summarize the information I have, by the day of the week. Let's say I got a table with following entries for instance:
+-----------+-----------------------+----------+---------------------+
| Day | completedtasks | duration | educationDepartment |
+-----------+-----------------------+----------+---------------------+
| Monday | Some stuff to do | 6 | A Department |
| Tuesday | Some other stuff to do| 8 | Another Department |
| Wednesday | Some other stuff to do| 6 | Test Department |
| Thursday | Being lazy | 8 | Another Test |
| Friday | A completed task | 8 | Another Test |
| Monday | Some entry | 2 | A Test |
| Wednesday | Test entry | 2 | Another Test |
+-----------+-----------------------+----------+---------------------+
I tried several queries, but those didn't give me the results I wanted to have. When I used GROUP BY it just gave me on of the entries I had in the table like this:
+-----------+-----------------------+----------+---------------------+
| Day | completedtasks | duration | educationDepartment |
+-----------+-----------------------+----------+---------------------+
| Monday | Some stuff to do | 6 | A Department |
+-----------+-----------------------+----------+---------------------+
This query:
SELECT DAYNAME(date) AS Day,
completedtasks,
duration,
educationDepartment
FROM programm_completedtask
WHERE DAYNAME(date)
LIKE "Monday";
gave me following result.
+-----------+-----------------------+----------+---------------------+
| Day | completedtasks | duration | educationDepartment |
+-----------+-----------------------+----------+---------------------+
| Monday | Some stuff to do | 6 | A Department |
| Monday | Some entry | 2 | A Test |
+-----------+-----------------------+----------+---------------------+
My aim is to get a result like this:
+-----------+-----------------------+----------+---------------------+
| Day | completedtasks | duration | educationDepartment |
+-----------+-----------------------+----------+---------------------+
| Monday | Some stuff to do, | 6,2| A Department, A Test|
| | Some entry | | |
+-----------+-----------------------+----------+---------------------+
So, I want to summarize the entries for one specific weekday and I want it in one row. I hope that this is even possible in some way. I appreciate the help very much !