Sorry I was not very clear. I could not figure out how to get the report layout to display right in my post. I could not get the columns to line up vertically but your answer seems like you figured it out.
My example listed 10 categories but depending on the options the user selects there could be any number of categories. So the number of columns in my html table is built dynamically. I issue a query to the category table and stuff the results in an array. Then a query is issued that pulls out all the members that belong to any of the selected categories. I figured, repeatedly looping through the array and stepping through the main query once, would be faster than a bunch of selects or locates in the main query.
For further explanation: There are three tables. The table of categories, a table of members and a table containing the id field from the category and members tables.
members table:
id
name
addr
categories table:
id
name
catmembers table:
member_id
category_id
I will try to work out something from your example. Thanks again!