I have 3 tables. Comments, profiles, and pictures. First I
pull out 3 rows from the Comments table. After I get those
comments, I want to pull the profile from profiles that made each
comment, and then lastly pull the pic from pictures that is
attached to profiles. I can't seem to get it right. I want to
display the profile pic with some profile info along with the
comment.
Right now I do this and it displays 3 pics with one profile
summary and one comment, then 2 pics, then 1.
Rough code:
<!--- Get comments --->
<cfquery name="comments">
SELECT * FROM comments WHERE comment_id = '2'
</cfquery>
<cfoutput query="comments">
<!--- Join comments --->
<cfquery name="comment_profiles">
SELECT p.*,d.*
FROM profile p, pictures d
WHERE p.id = d.id AND p.id = '#comments.comment_id#'
GROUP BY p.id
</cfquery>
When I display this it acts strangely... My code must be a
mess!