View Full Version : Nested repeating regions (sorta)

10-29-2007, 05:45 PM
I have an application. Two different tables, moms and children. tied by the mom_id.

I created a query to pull all the children from each mom. I can insert the mothers first and last - childs first and last and create a repeating region so it list each child tied to each mom in a long list.

So it would look something like

Mom 1 - child 1
mom 1 - child 2
mom 1 - child 3
mom2 - child 1
mom2 - child 2

What I want to do is something like:
Mom 1- child1, child2, child 3
Mom 2 - child 1, child 2

So, I kind of want to repeat each record for each mom then go on to the next mom and repeat. The only way I know how to do this is to create a seperate query for each mom. That would be very long and tedious and wouldn't work once another mom was added by an admin to the database.
There's got to be a simpler way of doing this. I'm using PHP / MySQL btw.

The query I'm currently using is:
SELECT childs_info.child_id, childs_info.child_first_name, childs_info.childs_last_name, mothers_info.mom_id, mothers_info.first_name, mothers_info.last_name
FROM childs_info, mothers_info
WHERE (mothers_info.mom_id=childs_info.mom_id)
ORDER BY mothers_info.last_namethen inserting {mothers_info.last_name} {mothers_info.first_name} - {childs_info.last_name} {childs_info.first_name} within a repeating region.