MySQL Subgroup?

majster900

New Member
I'm still getting the hang of more advanced MySQL queries, so bear with me here...I have a table (1 table) with the following columns: \[code\]name\[/code\], \[code\]source\[/code\], \[code\]destination\[/code\], \[code\]count\[/code\]I want to group my results by \[code\]name\[/code\], then subgroup them by the pairing between \[code\]destination\[/code\] and \[code\]source\[/code\].So far all I have is this query:\[code\]SELECT name, destination, source, COUNT(*) FROM clicks_today GROUP BY name, destination, source\[/code\]Which gives me groups like this:\[code\]group 1- name 1- destination 1- source 1group 2- name 1- destination 2- source 2(etc)\[/code\]What I'd really like is something like this:\[code\]group 1- name 1 - destination 1 - source 1 - destination 2 - source 2group 2- name 2 - destination 1 - source 1 - destination 2 - source 2\[/code\]I'm using PHP to query and display my results, pulling my results with \[code\]mysql_fetch_assoc\[/code\]. I want an array inside an array, basically.Does that make sense? How can I do this?
 
Back
Top