Solved

How do I Flip a Table?

Posted on 2002-05-10
2
118 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

Free camera licenses with purchase of My Cloud NAS

Milestone Arcus software is compatible with thousands of industry-leading cameras for added flexibility. Upon installation on your My Cloud NAS, you will receive two (2) camera licenses already enabled in the software. And for a limited time, get additional camera licenses FREE.

Question has a verified solution.

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

Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

863 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

20 Experts available now in Live!

Get 1:1 Help Now