Forum Moderators: open

Message Too Old, No Replies

Multiple record display from join query

I can't get the records to display without repeating fields

         

carolechapman

11:59 am on Oct 16, 2008 (gmt 0)

10+ Year Member



Hi

I have 3 tables, retreats, retreattypes and retreatfeatures. I want to display all the retreats that match a certain type and I also want to display all the features for each of those reatreats

"SELECT retreats.RID, retreats.retreat, retreattype.type, retreatfeatures.feature FROM retreattype, retreats
LEFT JOIN retreatfeatures ON (retreatfeatures.RID=retreats.RID)
WHERE (retreats.RID=retreattype.RID) AND (retreattype.type='$type')
GROUP BY retreats.retreat";

The query displays the correct records BUT
If I Group, only one feature displays for each retreat.
If I don't group, retreats repeat themselves, each with a different feature until the features are exhausted

(For display I have <?php echo $row_retreat['feature']; ?>)

Can anyone point out where I am going wrong?

Thanks

[edited by: eelixduppy at 2:56 pm (utc) on Oct. 16, 2008]
[edit reason] disabled smileys [/edit]