I have a table looking like this :
Table: table_name
name priority day hour
-------------------------------------
name1 1 monday 21:00
name2 3 tuesday 21:00
name3 1 monday 21:00
name4 2 monday 21:00
name5 2 sunday 22:00
name6 1 sunday 23:00
name7 1 thursday 00:00
name8 2 sunday 22:00
Is someone as any idea how I can do a request, then manipulate the result to aggregate the result as below (without the column header of course) :
priority day hour name
-----------------------------------------------
1 monday 21:00 name1,name3
3 tuesday 21:00 name2
2 monday 21:00 name4
2 sunday 22:00 name5,name8
1 sunday 23:00 name6
1 thursday 00:00 name7
I want to group by priority and day and hour.
Priority can be 1 to 5.
Day can obviously be Monday to Sunday
Hour can obviously be any hours :)
Name can be anything.
At the end, I need a SQL query to write the formatted results into a file.