从mssql DB插入值并搜索值

I've made a connection with a DB and I want to output a shedule.

Date - Room - Event

For now I will see every event with the room,

But I want the events to be grouped per room.

so output should be something like

Date - Room1 - event 1
               event 2

Date - Room2 - event 3

Date - Room3 - event 4
             - event 5
             - event 6

Also, this should be done in the php, not in the sql query.

any help on this would be very much appreciated.

select date,room,STUFF((select ' '+eventname from yourtable where t.room=t1.room for xml path('')),1,1,'') as events
from yourtable
group by room