I want to be able to perform a complicated select statement and then write the results, row by row to a snapshot table. I don't believe cold fusion will allow you to nest CFOUTPUT statements, so the only way I can think of to accomplish this is to generate the results set, store in an array of structures and then use that array as input to the inserts.<br><br>Is there a better way??<br><br> Thanks, <br> Dave<br><br><CFPARAM name="szDate" default=#DateFormat(Now), "mm/dd/yy"
#><br><br><br><CFQUERY NAME="GetStatusData" DATASOURCE="Sites"><br> (SELECT plant, status, status_date, N1, Start_Date,<br> (Select count(*) FROM list1_tbl<br> WHERE resp_person = 'Dave' <br> AND status = 'Open'<br> AND plant = list2_tbl.plant) as dave_open, <br> (Select count(*) FROM list1_tbl<br> WHERE resp_person = 'John' <br> AND status = 'Open'<br> AND plant = list2_tbl.plant) as john_open<br> FROM list1_tbl<br> where N1 NOT EQUAL "C"<br> ORDER by Start_Date, plant)<br></cfquery><br><br><CFQUERY NAME="CreateSnapshot" DATASOURCE="archive_Status"><br>INSERT INTO StatusSnapshot(SnapshotDate, Plant, nweek, dave_open, john_open, status, status_date)<br> Values ('#szDate#', '#nweek#', '#dave_open#', '#john_open#', '#status#', '#status_date#')<br></cfquery><br><br><html><br><head><br> <title>Untitled</title><br></head><br><br><body><br><br> <CFOUTPUT QUERY="GetStatusData"><br> <CFSET nWeek = #DateDiff("WW", Start_Date, Now())# + 1><br> <CFOUTPUT QUERY="CreateSnapshot"><br> </cfoutput><br></cfoutput><br>