How to display a db record with a variable number of joined records
I'm building a website for an airshow http://www.hollisterairshow.com and the organiser would like to post a list of things he needs for the show and have people respond via the website. For example, he might need 20 tents and potentially up to 20 people could respond, each offering one tent, or fewer people could each offer several tents. I'd like to create a view showing the item needed and underneath it one row for each offer he receives. I already have a couple of tables defined, one called "needs" and the other called "offers" , the "offers" table has a column called "needId" which is the index from the needs table.
So far I have created a recordset to join the tables but each row contains the need and the offer so I'm seeing the need repeated on each row and I only want to see it once. Here's the SQL generated by DW CS4
SELECT needs.needId, needs.title, needs.`description`, needs.quantity, needs.needMet, offers.needId, offers.offerId, offers.name, offers.email, offers.phone, offers.quantity, offers.`comment`
FROM needs, offers
WHERE needs.needId = offers.needId
ORDER BY needs.title
I'm sure there must be a simple solution to this but I'm unable to figure it out. I'm new to SQL and doing this as a volunteer for the airshow.
Thanks,
Tony