I have two MySQL tables, groups and users:
groups: group_id, group_name
users: user_id, user_name, group_id, etc.
I would like to produce one table for each group which will list all the
members for that particular group. For example:
Blue (group_id 1)
Tom (group_id 1)
Nancy (group_id 1)
Jim (group_id 1)
Red (group_id 2)
Bob (group_id 1)
Susan (group_id 1)
James (group_id 1)
My question is, do I need to run 2 queries? The first to select all the
groups and the second to select all the users in each group based on the
group_id? How would I loop through to create a table for each group?
Thanks in advance for any help.