Solved

How do I Flip a Table?

Posted on 2002-05-10
2
124 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Simple, centralized multimedia control

Watch and learn to see how ATEN provided an easy and effective way for three jointly-owned pubs to control the 60 televisions located across their three venues utilizing the ATEN Control System, Modular Matrix Switch and HDBaseT extenders.

Question has a verified solution.

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

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

728 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