Solved

How do I Flip a Table?

Posted on 2002-05-10
2
121 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:
Scott Bennett 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:Scott Bennett
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Tool to email me when a website changes 29 128
Has my website been infiltrated? 21 64
change time in cron 4 78
whm high memory usage in processes 7 87
In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
When it comes to showing a 404 error page to your visitors, you do not want that generic page to show, and you especially do not want your hosting provider’s ad error page to show either. In this article, I will show you how to enable the custom 40…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

785 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