> >If all your photos will have prices you won't need to left join you > can > >just join on them. > > > > > > > >Joel Watson wrote: > >> > > That's true, but when I combine it with the LEFT OUTER JOIN on the > comments, it screws up the comments. While it will return the prices > information fine, it duplicates the comments values for the number of > price fields there are. For example, each photo currently has 8 > price values which are being returned. With the query and output that > I currently have, the photos with comments have their comments values > returned the number commens * 8. So if photo1 has 3 comments, it will > return 24 values for the comments. > > I am pasting below the current query that I have, as well as my > current output structure. > > Thanks for everyone's help so far---it's almost there! > > <cfquery name="rsPhotoInformation" datasource="#application.dsn#"> > SELECT * > FROM photos > JOIN prices ON > photos.photoID = prices.photoID_fk > LEFT OUTER JOIN comments ON > photos.photoID = comments.photoID_fk > WHERE categoryID_fk = <cfqueryparam value="1" > cfsqltype="cf_sql_integer"> > </cfquery> > > > <cfoutput query="rsPhotoInformation" group="photoID"> > #photoTitle# <br /> > > <cfoutput group="priceID"> > #priceValue# <br /> > </cfoutput> > > <cfoutput> > #commenter# > </cfoutput> > > <br /> > <br /> </cfoutput>
Sorry to bump this thread...any ideas anyone? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Get the answers you are looking for on the ColdFusion Labs Forum direct from active programmers and developers. http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72&catid=648 Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:284401 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4