What goes wrong with your joined query?

Look into grouping in cfoutput for the answer to your second question.

Ade

-----Original Message-----
From: Saturday (Stuart Kidd) [mailto:[EMAIL PROTECTED]
Sent: 27 September 2005 16:02
To: CF-Talk
Subject: Queries oh queries


Hi,

I'm trying to retrieve data from two tables in one query, when i was  
just querying one everything was okay:

                 <cfquery name="GetAuthors" datasource="user020">
                 SELECT authorID, authorPhotograph, authorFirstName,  
authorSurname, authorAboutMe
                 FROM tbl_020authorDetails
                 WHERE authorPhotograph <> ''
                 </cfquery>

But my two table query (join) had a problem:

                 <cfquery name="GetAuthors" datasource="user020">
                 SELECT tbl_020authorDetails.authorID,  
authorPhotograph, authorFirstName, authorSurname, authorAboutMe,  
tbl_020articleDetails.articleID, tbl_020articleDetails.authorID,  
articleTitle
                 FROM tbl_020authorDetails, tbl_020articleDetails
                 WHERE authorPhotograph <> ' ' AND  
tbl_020articleDetails.authorID = tbl_020authorDetails.authorID
                 </cfquery>

The thing is that I am trying to pull all the authors and their  
articles - but some authors have more than one article, is this the  
best way to do it?

I'm also worried that if i pull the data like in the join above (if  
that even works properly) how do i break it down, ie how do i  
differentiate between getting information for individual authors?

                     <cfoutput query="GetAuthors">
                     <div class="contributorminibox"  
onclick="javascript:clickarticle(this)">
                         <div class="contributorphotograph">
                             <img  
src="#PhotosWritersWeb##GetAuthors.authorPhotograph#">
                         </div>
                         <div class="contributortext">
                             #authorFirstName# #authorSurname#
                             <p>#ParagraphFormat(authorAboutMe)#</p>
                         </div>
                         <div class="contributorurls">
                             The titles to go here.
                         </div>
                     </div>
                     </cfoutput>


Thanks for any help.  Should I just keep this in two queries?

Saturday

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:219340
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to