MySQL (or PHP?) group results by field data

Andi

New Member
I have a MySQL database that looks similar to this:\[code\]ID Group Name1 1 John2 1 Andrea3 1 Jack4 2 Mike5 2 Kurt6 3 Alice\[/code\]I need to sort the results in a html table that looks like this:\[code\]Group Name----------------------- 1 John Andrea Jack----------------------- 2 Mike Kurt----------------------- 3 Alice-----------------------\[/code\]I don't know if this should be done with a SQL query (concat_group, or something similar) or with PHP, can somebody please help me out?Guys, thanks for the help below, but I also need to accomplish something similar, like this:\[code\]ID meta_key meta_value name1 group 1 John2 group 1 Andrea3 group 1 Jack4 group 2 Mike5 group 2 Kurt6 group 3 Alice\[/code\]and I need to sort / display the same as the example above, something like this:\[code\]group name----------------------- 1 John Andrea Jack----------------------- 2 Mike Kurt----------------------- 3 Alice-----------------------\[/code\]Now my problem has taken new dimensions. My database looks like:\[code\]b.ID b.meta_key b.meta_value a.title 1 group 1 Title 12 group 1 Title 23 group 1 Title 34 group 2 Title 45 group 2 Title 56 group 3 Title 67 coef 6 Title 18 coef 4 Title 29 coef 12 Title 39 coef 2 Title 49 coef 3 Title 59 coef 7 Title 6\[/code\](I'm working with to tables)And i need to acchieve:\[code\]group title coef--------------------------------- 1 Title 1 6 Title 2 2 Title 3 12-------------------------------- 2 Title 4 2 Title 5 3-------------------------------- 3 Title 6 7--------------------------------\[/code\]?Is this even possible?Thanks Again Guys!
 
Back
Top