Assuming that we're doing this in cf you could
<cfquery name="topicsunits">
SELECT topics.topicID, topics.topicName, units.unitID, units.unitName
FROM topics, units
WHERE topics.topicID *= units.topicID AND topics.moduleID = 2
order by topics.topicName,units.unitName
</cfquery>
Then use the output group attribute
 
<cfoutput query="topicsunits" group="topicName">
#topicName#
<cfoutput group="unitName">
    #unitName#
</cfoutput>
</cfoutput>
Should produce output that looks like
Introduction
    Unit 1
    Unit 2
    Unit 3
S of Star
T of Star
 
Of course the syntax always needs to be checked
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Adaryl Wakefield
Sent: Thursday, January 22, 2004 12:09 PM
To: [EMAIL PROTECTED]
Subject: [KCFusion] SQL help

This has been kicking my ass all morning and IM sure the solution is simple.
I have two tables
topics(topicID, moduleID, topicName)
units(unitID, topicID, unitName)
 
So far ive got:
SELECT topics.topicID, topics.topicName, units.unitID, units.unitName
FROM topics, units
WHERE topics.topicID *= units.topicID AND topics.moduleID = 2
 
And I need the output to look like
 
topicName
    unitName
    unitName
    unitName
topicName
topicName
topicName
 
Its the output that Im hung up on. The query returns
9, Introduction, 2, Unit 1
9, Introduction, 3, Unit 2
9, Introduction, 6, Unit 3
10, S of Star, Null, Null
11, T of Star, Null, Null
12, A of Star, Null, Null
13 R of Star, Null, Null
 
And I have no clue how to spit that out right.
 
Adaryl "Did you reboot?" Wakefield
Aviator by passion
Programmer by sheer force of will

Reply via email to