Re: Dynamically output data

2011-01-13 Thread Michael Grant

I'd use something like this for the query.

select t1.name, t2.wkid, t2.title
from Table2 t2
left join Table1 t1
on t1.WKID = t2.WKID



On Thu, Jan 13, 2011 at 8:15 PM, Frank Liu fliu2...@gmail.com 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:
 WKIDTitle
 1002Math Tecaher
 1002Science Teacher
 1002English 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:340819
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Dynamically output data

2011-01-13 Thread Azadi Saryev

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:
 WKIDTitle
 1002Math Tecaher
 1002Science Teacher
 1002English 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