Solved

How do I Flip a Table?

Posted on 2002-05-10
2
117 Views
Last Modified: 2013-12-24
Hi Guys!

How do I turn a CFQUERY record set that CFDUMPs like this:

<table border="1" cellspacing="0" cellpadding="1" bgcolor="#eeaaaa" bordercolor="Red">
     <tr bgcolor="#eeaaaa" >
     
          <td valign="top">DIVISION</td>
     
          <td valign="top">PROGRAM_NAME</td>
     
     </tr>
     <tr> <td valign="top" bgcolor="#ffffff"> Team </td> <td valign="top" bgcolor="#ffffff"> Bear Street </td> </tr> <tr> <td valign="top" bgcolor="#ffffff"> Team </td> <td valign="top" bgcolor="#ffffff"> Clipboard Solutions </td> </tr> <tr> <td valign="top" bgcolor="#ffffff"> Team </td> <td valign="top" bgcolor="#ffffff"> Emerson Associates </td> </tr> <tr> <td valign="top" bgcolor="#ffffff"> Team </td> <td valign="top" bgcolor="#ffffff"> Lake Avenue </td> </tr> <tr> <td valign="top" bgcolor="#ffffff"> Team </td> <td valign="top" bgcolor="#ffffff"> Smithfield road </td> </tr> <tr> <td valign="top" bgcolor="#ffffff"> Cambridge Health Alliance </td> <td valign="top" bgcolor="#ffffff"> The Beck Ward </td> </tr> <tr> <td valign="top" bgcolor="#ffffff"> North East </td> <td valign="top" bgcolor="#ffffff"> The Oliver Street House </td> </tr>
     </table>

into something like this:

<TABLE BORDER="1" CELLSPACING="0" CELLPADDING="1" BGCOLOR="#EEAAAA" BORDERCOLOR="Red">
     <TR ALIGN="center">
          <TD COLSPAN="5">Team</TD>
          <TD COLSPAN="1">Cambridge Health Alliance</TD>
          <TD COLSPAN="1">North East</TD>
     </TR>
     <TR ALIGN="center" BGCOLOR="#FFFFFF">
          <TD COLSPAN="1">Bear Street</TD>
          <TD COLSPAN="1">Clipboard Solutions</TD>
          <TD COLSPAN="1">Emerson Associates</TD>
          <TD COLSPAN="1">Lake Avenue</TD>
          <TD COLSPAN="1">Smithfield road</TD>
          <TD COLSPAN="1">The Beck Ward</TD>
          <TD COLSPAN="1">The Oliver Street House</TD>
     </TR>
</TABLE>
0
Comment
Question by:dbabbitt
  • 2
2 Comments
 
LVL 14

Accepted Solution

by:
SBennett earned 100 total points
ID: 7001795
You could do something like this:

<TABLE BORDER="1" CELLSPACING="0" CELLPADDING="1" BGCOLOR="#EEAAAA" BORDERCOLOR="Red">
<TR ALIGN="center">
<cfoutput query="MyQuery" group="Division">
     <cfquery name="GetCount" dbtype="query">
          SELECT Division
          FROM MyQuery
          WHERE Division = #MyQuery.Division#
     </cfquery>
         <TD COLSPAN="#GetCount.RecordCount#">#MyQuery.Division#</TD>
</cfoutput>
     </TR>
     <TR ALIGN="center" BGCOLOR="#FFFFFF">
     <cfoutput query="MyQuery"><TD>#MyQuery.Program#</TD></cfoutput>
     </TR>
</TABLE>
0
 
LVL 14

Expert Comment

by:SBennett
ID: 7001797
that assumes you are doing a query like this:

<cfquery name="MyQueryName" datasource="MyDSN">
SELECT Division, Program
FROM MyTable
ORDER BY Division
</cfquery>
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now