[thelist] CFMX Nested Queries

Russ russ at unrealisticexpectations.com
Tue Feb 1 18:50:08 CST 2005


Grr, sorry...

I'm attempting to pull some information from 2 tables in my database
(where I'm storing my RSS feed information):

tblRSS and tblFeed

Both share "rssID".

I've got code as follows:

//Query the RSS table for the ID, Title, etc.
<cfquery name="qRSS" datasource="#dns#">
SELECT *
FROM tblRSS
ORDER BY rssID ASC
</cfquery>

//Build the holding table for the data and display the rssTitle
<cfoutput query="qRSS">	
<div id="rightbox">
<table width="140" border="0" align="center" cellpadding="0"
cellspacing="0">
  <tr>
    <td align="center"><h1>#rssTitle#</h1></td>
  </tr>

//Query Feed table for the link and title corresponding to the RSS
<cfquery name="qFeed" datasource="#dns#" maxrows="5">
SELECT *
FROM tblFeed
WHERE tblFeed.rssID=#qRSS.rssID#
ORDER BY feedID DESC
</cfquery>
<cfoutput>
  	<tr>
	<td align="center">
    
	<a href="#qFeed.feedLink#" target="_blank">#qFeed.feedTitle#</a>
</td>
  </tr>
</cfoutput> //close out the Feed query
  </table>
</div>	  
<br><br>
</cfoutput> //close out the RSS query


As you may or may not imagine, this isn't really working.  Since I've
got 8 rows, I get a 8 results of the same item in my first displayed
table, 7 of the 2nd and so on...

I'm sure that this is much simpler than I'm making it, but can anyone
offer some insights?

Thanks!

Russ




More information about the thelist mailing list