something like this:

<cfquery name="getData" ...>
SELECT t1.wkid, t1.name, t2.title
FROM Table1 t1 LEFT JOIN Table2 t2 ON t1.wkid = t2.wkid
ORDER BY wkid, title
</cfquery>

now output using GROUP attribute of <cfoutput> tag and nested <cfoutput>:
<cfoutput query="getData" group="wkid">
WKID: #wkid#<br>
Name: #name#<br>
Title:<br>
<cfoutput>
   #title#<br>
</cfoutput>
</cfoutput>

Azadi

On 14/01/2011 09:15 , Frank Liu wrote:
> Hello
> I am new to coldfusion. Please help
>
> In Table1, I have something like this:
>
> WKID             Name
> 1002             High School
>
> In Table2, I have something like this:
> WKID            Title
> 1002            Math Tecaher
> 1002            Science Teacher
> 1002            English Teacher
> (more)          (more)
>
> I need output to be like this:
>
> WKID:  1002
> Name:  High School
> Title:
> Math Teacher
> Science Teacher
> English Teacher
> .... (more)
>
> I have problem with output table2.
> Thank you.
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340830
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to