Link to home
Start Free TrialLog in
Avatar of diecasthft01
diecasthft01

asked on

another question with Coldfusion queries and group by

I had this question after viewing Getting data within a CFLOOP.

Hell again!! I wanted to try to expand on a functionality that I was helped with on here, and hopefully it will be a simple oversight on my part, but I wanted to get all of the records for one project and have those records placed in a textarea box, and that works great. But I also want to have a second textarea box that only shows the most recent comment per project number, and that textarea box will be modifiable, so a user can change the change inside that single comment on that textarea box. The code I have is below, but I can't seem to get the query right to get the single record for one textarea, while also getting all records for the other textarea.

<CFQUERY DATASOURCE="PDBARMYDEV" NAME="CecomInput">
 SELECT current_bulk_filter.proj_no,
current_bulk_filter.capces_location,
current_bulk_filter.capces_state,
current_bulk_filter.capces_description,
capces_support_history.proj_closed_reason

 FROM   mca.current_bulk_filter
   
left join mca.capces_support_history
on current_bulk_filter.proj_no = capces_support_history.proj_no  

where capces_support_history.proj_closed_reason is not null      
 order by current_bulk_filter.proj_no asc
</CFQUERY>



<cfoutput query="CecomInput" group="proj_no">
       <!--- This will print once for every project --->
       proj_no = #proj_no#<br>
       <!--- This will print each reason within a single textarea --->
     <textarea><cfoutput>#proj_closed_reason##chr(10)#</cfoutput></textarea>
     <br>
</cfoutput>
ASKER CERTIFIED SOLUTION
Avatar of _agx_
_agx_
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of diecasthft01
diecasthft01

ASKER

Perfect!!! Thank you so much!!!
Glad it helped!