Jefry Houser got it down to one database query and one query of a query:

  <cfquery name="Loop2">
     select Division, Program_Name from table
  </cfquery>

  <cfquery dbtype="query" name="Loop1">
    select Distinct Program_Name, Count(Division) as colspan from Loop2
   </cfquery>

  Then look similar to the way I Set up the above table:
<table><tr>
  <cfoutput query="Loop1">
     <td colspan="#loop1.colspan#>#loop1.Division#</td>
   </cfoutput>
   </tr><tr>
  <cfoutput query="Loop2">
    <td>#loop2.Program_Name#<td>
  </cfoutput>
  </tr></table>

And he didn't even stumble over any furniture! :-)
The nice thing about this solution is that you can change the CFOUTPUTs to
CFLOOPs because it doesn't use grouping.

-----Original Message-----
From: Nathan Stanford [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 10, 2002 12:56 PM
To: CF-Talk
Subject: RE: How Do I Flip A Table?


So what was the solution that actually worked?

Nathan

> -----Original Message-----
> From: Dave Babbitt [mailto:[EMAIL PROTECTED]]
> Sent: Friday, May 10, 2002 9:33 AM
> To: CF-Talk
> Subject: How Do I Flip A Table?
>
>
> 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>
>
> I left the COLSPANs in there as a possible help to solving the general
> problem. I suspect there is a more eloquent solution than
> performing two or
> three subqueries, though. :-)
>
> Thanx
>
> Dave
>
>

______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to