Hi Luke,

Assuming the ID field is in the categories table and
has the same value as the sub_categories.catid (relation),
modify the query:

<cfquery name="cats" datasource="localads">
 SELECT categories.ID, categories.cat_name, sub_categories.sub_name,
sub_categories.sub_id
 FROM categories, sub_categories
 WHERE categories.ID = sub_categories.catid
 AND sub_categories.catid = #url.cid#
 ORDER BY categories.cat_name
</cfquery>

and use the following code to output the results:

<Cfoutput query="cats" group="cat_name">
<p>
#cats.cat_name# - Sub Cats:
<p>
<cfoutput>#cats.sub_name#<br></cfoutput>
</cfoutput>

Best, Miro.

-----Original Message-----
From: W Luke [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 18, 2000 10:50 AM
To: [EMAIL PROTECTED]
Subject: Query Problem


[I did post this last night, but my mail server didn't deliver it.  So here
it is again]

Hi,

I'm probably being stupid here but can someone please help me on my query?
It's displaying the correct results - but more than once:

<cfquery name="cats" datasource="localads">

 SELECT ID, cat_name, sub_name, sub_id, catid
 FROM categories, sub_categories
 WHERE sub_categories.catid = #url.cid#

</cfquery>
<Cfoutput>#cats.cat_name# - Sub Cats:</cfoutput>
<Cfoutput query="cats">#sub_name#<br></cfoutput>

Any help appreciated.

Will


----------------------------------------------------------------------------
--
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to